Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS7 Auto Layout, View Resize and iAds
    primarykey
    data
    text
    <p>I'm using Auto Layout in my iOS 7 project with the following view hierarchy</p> <p>Main View<br> -Container View<br> ---Button<br> ---Button<br> ---ImageView<br> -Banner View (iAd Banner View)</p> <p>The Main View and Container View are full width and height of screen. I have Horizontal and Vertical Space Constraints on the Container View sticking to the main view (screen's height and width). And also the subviews of Container View are constrained to the button of the view with a 20px space.</p> <p>My issue occurs when the Banner View is finally filled and placed at the bottom of the screen, which then I have the Container View subtract the Banner View's Height from its frame height to allow space for the Banner View to show. (code used below) The ideal outcome is the Container View to subtract the height and its subviews constraint update based on this new height ,but what end up happening is the iAD Banner View just overlays the view as shown in the picture.</p> <p>Code for BannerViewDidLoadAd:</p> <pre><code>- (void)bannerViewDidLoadAd:(ADBannerView *)banner { CGRect contentFrame = self.containerView.bounds; CGRect bannerFrame = self.bannerView.bounds; if (self.bannerView.bannerLoaded) { contentFrame.size.height = self.containerView.frame.size.height - self.bannerView.frame.size.height; bannerFrame.origin.y = contentFrame.size.height;; } else { bannerFrame.origin.y = contentFrame.size.height; } [UIView animateWithDuration:animated ? 0.25 : 0.0 animations:^{ [self.containerView setFrame:contentFrame]; [self.containerView layoutIfNeeded]; self.bannerView.frame = bannerFrame; self.bannerView.hidden = NO; }]; [self.containerView updateConstraints]; } </code></pre> <p>Image of iAd overlaying Container View and it's SubViews</p> <p><img src="https://i.stack.imgur.com/pQeJ8.png" alt="iad overlaying"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload