Question

I had iAds working fine in my app for iOS 6, they would appear above the tab bar and work absolutely fine; however with iOS7 and Xcode 5, my ads appear underneath the tab bar. I know it loads the app as I can see 'bannerViewDidLoadAd' and a very fait line appears at the top of the tab bar.

I have also downloaded the Apple iAdSuite and the tab bar example does exactly the same!

Please can anybody help as to why the ads are appearing underneath the tab bar and not above it?

Sorry my code for setting the frame:

`- (void)viewDidLayoutSubviews
{
CGRect contentFrame = self.view.bounds, bannerFrame = CGRectZero;
ADBannerView *bannerView = [BannerViewManager sharedInstance].bannerView;

// If configured to support iOS >= 6.0 only, then we want to avoid
// currentContentSizeIdentifier as it is deprecated.
// Fortunately all we need to do is ask the banner for a size that fits into the layout
// area we are using. At this point in this method contentFrame=self.view.bounds,
// so we'll use that size for the layout.
//
bannerFrame.size = [bannerView sizeThatFits:contentFrame.size];

if (bannerView.bannerLoaded) {
    contentFrame.size.height -= bannerFrame.size.height;
    bannerFrame.origin.y = contentFrame.size.height;
} else {
    bannerFrame.origin.y = contentFrame.size.height;
}
self.contentController.view.frame = contentFrame;

// We only want to modify the banner view itself if this view controller is actually
// visible to the user. This prevents us from modifying it while it is being displayed elsewhere.
//
if (self.isViewLoaded && (self.view.window != nil)) {
    [self.view addSubview:bannerView];
    bannerView.frame = bannerFrame;
}
[self.view layoutSubviews];
}

- (void)updateLayout
{
    [UIView animateWithDuration:0.25 animations:^{
        [self.view setNeedsLayout];
        [self.view layoutIfNeeded];
    }];
}`
Was it helpful?

Solution

On the attributes inspector for the view where you are adding the iAds pannel is the Under Bottom Bars or Under Opaque Bars checked in the Extend Edges section. Unchecking them might solve your problem. These are new settings for iOS 7.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top