Currently I use this to code for loading the iAD banners.
- (void)viewDidLoad
{
[super viewDidLoad];
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
CGRect adFrame = adView.frame;
adFrame.origin.y = self.view.frame.size.height;
adView.frame = adFrame;
[adView setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[self.view addSubview:adView];
adView.delegate=self;
self.bannerIsVisible=NO;
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
CGRect adFrame = adView.frame;
adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
adView.frame = adFrame;
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
CGRect adFrame = adView.frame;
adFrame.origin.y = self.view.frame.size.height+adView.frame.size.height;
adView.frame = adFrame;
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
The problem is that I want to auto set the iAD view to the bottom of the view also when the device orientation changes. I tried lots of things but none of thim are working.
Also why do I have to use notification center to check device orientations? DidRotateToInterfaceOrientation
doesn't seem to work.