简体   繁体   中英

AdMob Banner Covers Bottom Toolbar

I have just loaded an AdMob test banner to my ViewController. I dragged in a View at storyboard level and set it to be the AdMob banner (and I fixed it's size to : 320x50).

But it covers my bottom toolbar.

In Xcode, I have set my toolbar (using storyboard constraints) to the bottom of the view (0 distance to bottom of view); and I set the AdMob banner view to sit just above the bottom toolbar (0 distance to bottom toolbar, using constraints in the storyboard).

When I run the simulator on my device, the banner appears at the bottom of the view on top of and covering my bottom toolbar.

How can I set my parameters so that the banner (if it displays) will always show just on top of the bottom toolbar, not cover it?

I found a the exact same question here :

AdView Banner (SubView) covers the bottom toolbar in my app. How do I make sure the toolbar is fixed below the banner?

but the answer (which was not accepted) was :

I had this same problem, simple fix for me. You probably have "self.canDisplayBannerAds = YES;" in your -viewDidLoad method. Move it to your -viewDidAppear method instead and see if that fixes it.

I don't have a viewDidAppear method currently in my ViewController.swift file.

I also realise that the actual AdMob banner displayed on my iPhone 6 is full width - while I set a fixed size to the view in my storyboard that 'holds' the AdMob banner. So obviously, the constraints I set for the banner at storyboard level is being overridden here.

What should I do?

Thanks.

I followed the advice from the related question:

AdView Banner (SubView) covers the bottom toolbar in my app. How do I make sure the toolbar is fixed below the banner?

I had this same problem, simple fix for me. You probably have "self.canDisplayBannerAds = YES;" in your -viewDidLoad method. Move it to your -viewDidAppear method instead and see if that fixes it.

It worked for me also - in my own context.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM