I am trying to construct a iOS universal application template that transparently handles iAds & screen rotations.
i.e. instead of using UIViewController for each new project, I will instead use my own iAdVC (which will subclass UIViewController). This will seamlessly handle the iAds, and hand over the remaining window space to the user.
I'm trying this: view controller contains uberView which contains {adView, content view}.
whenever an ad appears and disappears, both {adView, content view} will animate:
content view squashing the frame's top down slightly to make space for my iAd,
and fade in the ad along the top at the same time.
also, every time the device rotates, the views need to be resized.
I'm getting really dumb problem, when the first Ad gets served, I place it at the top of the screen and squash the remaining content frame to make space for it.
but if I change the content view's frame, I can no longer click the ad. and if I don't, the content view doesn't fit in its window,
- (void) bannerViewDidLoadAd: (ADBannerView *) banner
{
bool isLandscape = UIInterfaceOrientationIsLandscape( self.interfaceOrientation );
NSString * contentSize = isLandscape ? ADBannerContentSizeIdentifierLandscape : ADBannerContentSizeIdentifierPortrait ;
[self.adBannerView setCurrentContentSizeIdentifier: contentSize];
CGSize bannerSize = [ADBannerView sizeFromBannerContentSizeIdentifier: contentSize];
self.adBannerView.frame = CGRectMake(0, 0, bannerSize.width, bannerSize.height);
// resize content frame & fade ad in
CGRect newContentFrame = uberView.bounds;
newContentFrame.size.height -= bannerSize.height;
newContentFrame.origin.y += bannerSize.height;
NSLog(@"%@", NSStringFromCGRect(newContentFrame)); // {{0, 50}, {320, 430}}
if (1) // 0 works
self.contentView.frame = newContentFrame; // NOW CANT CLICK AD
}