I've installed iAd banners in my app using the new iOS 7 property on UIViewController, namely canDisplayBannerAds
. The trouble is that my view no longer resizes correctly on iOS 7. I'm using autolayout, in case you were wondering.
In portrait, the ad banner appears at the bottom of the screen. In landscape, the UI doesn't properly recenter, and remains as tall as a portrait screen. (My buttons and ad banner, which are constrained to the bottom of the screen, are truncated.) Essentially, the bounds of my view no longer updates correctly.
I've attempted to hide the disable canDisplayBannerAds
in willRotateToInterfaceOrientation
and then re-enable the property in didRotateFromInterfaceOrientation
. No dice.
I've manually traversed the view hierarchy to find the ad banner and call sizeThatFits
on it. I'm not confident that I did this correctly, so this may be the answer.
I've tried explicitly setting autoresizing masks on the view that becomes the originalContentView
before enabling ads.
Removing my call to canDisplayBannerAds
alleviates all symptoms of the problem.
Am I missing something obvious? Is there another property or setting that I'm supposed to be toggling? Is this a bug?
EDIT:
I'm not actually installing the banner myself. Simply setting the canDisplayBannerAds
to YES
causes iOS to resize my entire hierarchy to make room for a banner ad which it then installs by itself.