6

In my app delegate, I instantiate an iAd banner and assign it to a delegate property, then I load the main View Controller.

In the main View Controller, I add the iAd banner as a subview, and also instantiate a "Main Menu" view controller and add its view as a subview. Great, now I have a main menu for my app (using UINavigationController so other views are pushed/popped off the navigation stack, leaving the ad on top).

However, when I display a modal dialog (like send e-mail), and dismiss it, the iAd banner is gone, and the Main Menu view now takes up the whole screen. Is there something I need to do to "refresh" the iAd view on the top?

Jay Imerman
  • 4,475
  • 6
  • 40
  • 55
  • +1 - I am running into a similar issue. If the iAd was on the bottom, when the modal view controller is dismissed, there is black where the iAd was, and the iAd shows at the top. Please help! – BigSauce Apr 22 '13 at 02:48
  • I'm curious how you always leave the ad on top? That may be a part of the cause. – Mariam K. Apr 23 '13 at 13:19
  • There could be a problem with your iAd positioning code. If that's the case then this might help: http://stackoverflow.com/a/9821394/653513 – Rok Jarc Apr 23 '13 at 13:58
  • I had problem like this. But i solved by following ways.. Try this.. - (void)bannerViewDidLoadAd:(ADBannerView *)banner { //NSLog(@"showing add"); adBanner.frame = CGRectMake(0.0, yPostion, banner.frame.size.width, banner.frame.size.height); [self.view addSubview:adBanner]; [self.view bringSubviewToFront:adBanner]; } – Raj Subbiah Apr 25 '13 at 11:18
  • I learned the solution to this issue: https://devforums.apple.com/message/805896#805896 – BigSauce Apr 25 '13 at 18:49
  • @TrueLifeCoder - interesting, that wasn't my case though. I wanted my ad to stay on top of all views except modal dialogs. So I have a UINavigationController opened up first thing with a UITableView, with the ad above. Then I tap the "About" button, which pops up a modal view, then when I dismissed, the ad banner would be gone and the nav controller would take up the whole screen. – Jay Imerman May 03 '13 at 18:30

1 Answers1

2

It sounds like you have 2 UIViewControllers and you are trying to manually add the subview of one to the other without using any of the container API's - i am not surprised this doesn't work properly.

See "Creating Custom Container View Controllers" in the View Controller Programming Guide for iOS, or more easily, create a UIViewController subclass which always shows an Ad on top.

Daniel Broad
  • 2,512
  • 18
  • 14