Search code examples
iosobjective-cautolayoutuitabbarcontrolleriad

How do I remove empty space created by canDisplayAdBanner?


I added iAd to my application using self.canDisplayBannerAds. The application uses UITabBarController and that seems to be causing a problem. See the "empty" (gray) space in the screenshot below. enter image description here

The UITextView has the following constraints: enter image description here

And the program is very simple:

#import <iAd/iAd.h>
#import "ViewController.h"

@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.canDisplayBannerAds = YES;
}

@end

This simple program, with the canDisplayBannerAds commented out (or set to NO) doesn't have a gray rectangle at all. But with ads I can't seem to get rid of that "empty" (gray) rectangle. Does anyone have a suggestion to resolve this issue?

Demo project on github.


Solution

  • Just make your ViewController's TabBar to Opaque and your problem will be resolved.

    enter image description here