iAd width in landscape on iPad is narrow
I have an iAd in an iPad app. When the user rotates, I use setFrame to tell the ad's view to resize and move to the bottom of the screen. Unfortunately, although I am setting the width to 1024, iOS is not complying and the iAd's switch is rema开发者_高级运维ining at 768.
How to fix this?
Thanks.
To resize the banner view you must use the currentContentSizeIdentifier
property. The documentation:
Your application should never directly change the size of the banner view. Instead, set the currentContentSizeIdentifier property to a known advertising size. The view is automatically resized to match the new content size.
So to resize the banner view for landscape, you would do the following:
bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
If you need to know the actual size this will change the banner view's frame to, use the ADBannerView class method sizeFromBannerContentSizeIdentifier:
. So if you resize the banner view for landscape, then the new size will be
CGSize bannerViewSize = [ADBannerView sizeFromBannerContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
精彩评论