1

I have added canDisplayBannerAds into my application and it's working great with one minor exception, it causes my container view to get clipped for some reason.

In the image below it shows a UITextView above a Container View.
Notice on the right side that the container view isn't fully rounded and is not appearing to be left-aligned with the text view.

The left hand side shows how it looks with canDisplayBannerAds = NO.
The right hand side shows how it looks with canDisplayBannerAds = YES .

Example

I've tried reproducing this in a simple project, but wasn't able to yet. I have tried a suggestion I found elsewhere on SO to add [self.originalContentView layoutSubviews]; to viewDidLayoutSubviews but it didn't resolve the issue.

Before displaying the container view I am doing:

self.containerView.layer.cornerRadius = 10;
self.containerView.layer.masksToBounds = YES;

I removed the masksToBounds to see how it would look, and the left hand side still doesn't line up with the text view above it.

While I'm giving the textview left-align container view screenshot, when in landscape the container view is left-aligned to a label. This also works fine when not displaying ads. In addition, I am not referencing self.view anywhere in the code.

Is this just a bug with canDisplayBannerAds that I'm going to have to live with or is there something I can do about it?

Kurt Anderson
  • 932
  • 1
  • 10
  • 26
  • 1
    `canDisplayBannerAds` is known to cause many issues. Try adding the `ADBannerView` programmatically. Here's an example of how to implement iAd and AdMob banners programmatically. http://stackoverflow.com/a/28708377/2108547 – Daniel Storm Apr 28 '15 at 20:26
  • @DanielStorm I appreciate that post. Ultimately I feel going that route would require a lot more work (handling rotation, adjusting size classes' constraints). For now I resolved my situation by changing my leading to superview constraint from 0 to 4 while ads are displayed. – Kurt Anderson Apr 29 '15 at 00:58

0 Answers0