AdBannerView在iPad上滚动查看屏幕动画解雇
问题描述:
我在我的应用程序中的视图控制器上实现了AdBannerView。它在iPhone上运行良好,但在iPad上测试时出现问题。广告显示效果不错,但是当我关闭wifi以测试解散时,广告会将窗口内的所有元素与它一起放下,并将背景和tabbar留下。这只发生在iPad上。AdBannerView在iPad上滚动查看屏幕动画解雇
这里是我的动画广告视图代码:
- (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];
}
}
答
我在错误的位置的广告鉴于我的补偿框架。它恰好是iPhone框架的完美选择,因为创建广告足以将广告推向正确的位置。到了iPad的时候,计算出的偏移量将视图从视窗中移除,但还不足以回到视图中。