I have implemented AdBannerView on a view controller in my app. It works fine on iPhone, but when testing on iPad there is a problem. The ad shows up fine, but when I turn off wifi to test the dismissal, the ad takes all the elements inside the window down with it and leaves the background and tabbar in place. This only happens on iPad.
Here is my code for animating the ad view:
- (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation {
int adY = 432;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
adY = 955;
}
if (_adBannerView != nil) {
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
[_adBannerView setCurrentContentSizeIdentifier:
ADBannerContentSizeIdentifierLandscape];
} else {
[_adBannerView setCurrentContentSizeIdentifier:
ADBannerContentSizeIdentifierPortrait];
}
[UIView beginAnimations:@"fixupViews" context:nil];
if (_adBannerViewIsVisible) {
NSLog(@"Visible");
CGRect adBannerViewFrame = [_adBannerView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = adY -
[self getBannerHeight:toInterfaceOrientation];
[_adBannerView setFrame:adBannerViewFrame];
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y = adY +
[self getBannerHeight:toInterfaceOrientation];
contentViewFrame.size.height = self.view.frame.size.height -
[self getBannerHeight:toInterfaceOrientation];
_contentView.frame = contentViewFrame;
} else {
NSLog(@"Not Visible");
CGRect adBannerViewFrame = [_adBannerView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = adY;
[_adBannerView setFrame:adBannerViewFrame];
CGRect contentViewFrame = _contentView.frame;
contentViewFrame.origin.y = adY
+ [self getBannerHeight:toInterfaceOrientation];
contentViewFrame.size.height = self.view.frame.size.height;
_contentView.frame = contentViewFrame;
}
[UIView commitAnimations];
}
}