我有一个iAd显示在主视图的全屏子视图的顶部.iAd在纵向模式下正常工作,我已将iAd横幅视图的旋转处理为横向模式.用户在横向模式下轻触iAd时会出现此问题.测试广告以纵向,侧面显示在电话上,当用户点击x以关闭iAd时,横幅视图及其父视图被推离屏幕.iAd在纵向模式下正常运行(即点击它并关闭它会导致包含正常显示的横幅的视图).
我尝试过的事情:
- (void)bannerViewActionDidFinish:(ADBannerView *)banner{
NSLog(@"Ad was closed, show the adView again");
if(UIInterfaceOrientationIsLandscape(currentInterfaceOrientation)){
[self animateRotationToLandscape:0.3f];
}
else{
[self animateRotationToPortrait:0.3f];
}
}
-(void)animateRotationToPortrait:(NSTimeInterval)duration{
self.adView.currentContentSizeIdentifier =
ADBannerContentSizeIdentifierPortrait;
BOOL iPad = NO;
#ifdef UI_USER_INTERFACE_IDIOM
iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#endif
if (iPad) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:duration];
proUpgradeDescription.frame = CGRectMake(82,313,604,110);
proUpgradePrice.frame = CGRectMake(313,576,142,28);
closeButton.frame = CGRectMake(348,834,72,37);
purchaseButton.frame = CGRectMake(313,431,142,142);
[UIView commitAnimations];
}
else{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:duration];
proUpgradeDescription.frame = CGRectMake(20,80,280,70);
proUpgradePrice.frame = CGRectMake(88,322,142,28);
closeButton.frame = CGRectMake(123,403,72,37);
purchaseButton.frame = CGRectMake(88,172,142,142);
[UIView commitAnimations];
}
}
Run Code Online (Sandbox Code Playgroud)
我调用的代码用于为纵向和横向模式的显示器旋转设置动画.此代码无效.
如果有人对测试广告为什么不能正确旋转以及为什么他们将父视图控制器推离屏幕有任何想法,我将非常感激.