iAd left white blank screen after closed

非 Y 不嫁゛ 提交于 2019-11-30 23:51:25

Eventually I figured it out myself. It turns out the ADBannerView's parent view must be a fullscreen view. I my case above, I added AdBannerView to my adView, which is a view with size 320x50. When I changed its parent view to a fullscreen view, everything works. I am not sure if this is a bug in iAd, but certainly something tricky.

When the banner finishes, it moves itself to the top of the screen even if that means having a negative y coordinate. I center the banner when it finishes. In my case there is a view controller for just the banner, so it is only full screen when the ad is clicked.

-(void) bannerViewActionDidFinish:(UIView *)inBanner {
    CGRect                      frame = [inBanner frame];

    frame.origin.x = frame.size.width * 0.5;
    frame.origin.y = frame.size.height * 0.5;

    [inBanner setCenter:frame.origin];
}

Hey David! I know what you mean, I'm also using an own AdvertisementViewController which calls different ad networks.

So iAd is not in a full screen view but inside a 320x50 view.

Simply do this:

-(void) bannerViewActionDidFinish:(ADBannerView *)inBanner {

[self.view setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 50.0f)];

}

So the outer view container (self.view) is resized to its original size. iAd is resizing it to fullscreen for displaying the ad when an iAd is shown.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!