Shen
Shen

Reputation: 644

iAd banner pushes content of screen upwards when appearing at bottom

I'm having trouble with a bug I just can't seem to understand how to squash. I have an iAd banner at the bottom of my screen. When it loads in the simulator, it frequently pushes my images, labels, etc up as if it's resizing my background imageview; and therefore, all my constraints

Here is the code for my iAd banner:

func bannerViewWillLoadAd(banner: ADBannerView!) {

}

func bannerViewDidLoadAd(banner: ADBannerView!) {
    self.adBannerView?.hidden = false //now show banner as ad is loaded
}

func bannerViewActionDidFinish(banner: ADBannerView!) {

}

func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
    return willLeave
}

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
    self.adBannerView?.hidden = true
}

Now this problem only sometimes happen. You can see the difference at the bottom of my screen when comparing the two:

https://i.sstatic.net/jSSlF.jpg

https://i.sstatic.net/bE6tO.jpg

Any help would be greatly appreciated as to why this is occuring.

Upvotes: 2

Views: 186

Answers (1)

Tim
Tim

Reputation: 583

For some reason banner.hidden = true upsets the view. Instead, make the banner transparent: banner.backgroundColor = UIColor.clearColor()

Upvotes: 1

Related Questions