iAd Landscape奇怪的观看行为 [英] iAd Landscape Strange View Behavior

查看:147
本文介绍了iAd Landscape奇怪的观看行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iAd显示在主视图的全屏子视图的顶部。 iAd在纵向模式下正常工作,我已将iAd横幅视图的旋转处理为横向模式。用户在横向模式下轻触iAd时会出现此问题。测试广告以纵向,侧面显示在电话上,当用户点击x以关闭iAd时,横幅视图及其父视图将被推离屏幕。 iAd在纵向模式下正常运行(即点击它并关闭它会导致包含横幅的视图正常显示)。

I have an iAd which displays at the top of a fullscreen subview of the main view. The iAd works normally in portrait mode, and I have handled rotation of the iAd banner view into landscape mode. The issue occurs when the iAd is tapped by the user in landscape mode. The test advertisement displays in portrait, sideways on the phone, and when the user taps the x to dismiss the iAd, the banner view and its parent view are pushed offscreen. The iAd behaves normally in portrait mode (i.e. tapping it and closing it results in the view containing the banner to be displayed normally).

我尝试过的事情:

- (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];
    }
}

哪个调用我用来设置旋转动画的代码显示纵向和横向模式。这段代码没有效果。

Which calls code that I use to animate rotation of the display for portrait and landscape mode. This code has no effect.

如果有人想知道为什么测试广告没有正确旋转以及为什么他们将父视图控制器推离屏幕我会非常感谢。

If anyone has any ideas as to why the test advertisements don't rotate correctly and why they push the parent view controller off the screen I would greatly appreciate it.

推荐答案

我不知道这是否解决了你所有的问题,但根据答案这个问题,测试广告只是纵向和真实的广告将出现在两个方向上。

I don't know if this addresses all of your problems, but according to the answer on this question, the test ads are only in portrait, and real ads will show up in both orientations.

这篇关于iAd Landscape奇怪的观看行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆