0
votes

Feel free to reference a sample Xcode project hosted on GitHub which demonstrates this issue: IAdBannerBugDemo

When there is an AdBannerView being displayed underneath a UITableView and above a UITabBar, after bannerViewActionDidFinish: is invoked, the AdBannerView is erroneously moved to the top of its superview.

My questions are:

  1. Is there a valid workaround for this that isn't a hand jam? If so, what is the workaround?
  2. Is this a bug with the iOS SDK?

First off, here are two screenshots which illustrate my problem.

  1. Press the button shown in the 1st screenshot.
  2. Wait for iAd to load.
  3. Click the iAd.
  4. Dismiss the iAd by pressing the black X in the upper-left corner of the full-screen iAd.
  5. Notice that the iAd moves to the top (2nd screenshot)

Press the button shown and wait for an iAd to load

Ad loaded

Press/Click the iAd banner to view the ad fullscreen

press/click iAd banner

Dismiss the fullscreen iAd and notice iOS SDK moved the iAD banner to the top of its superview

bug illustration

By hitting breakpoints and such, I noticed that [UIViewControllerWrapper setFrame:] is responsible for relocating the AdBannerView, but that is completely out of my control, as it is part of Apple's frameworks.

The only way for me to work around this issue is to correct the location of the AdBannerView by overriding viewWillLayoutSubviews in whichever view controller is responsible for properly placing the AdBannerView.

But even this workaround produces a jumpy relocation of the AdBannerView from the top of its superview to the correct location (underneath the tableview, above the tab bar, contained in the table view's superview).

A good answer will be one that posts sample code illustrating how to defeat this nagging issue.

I have started a thread on Apple's Developer Forums, as well. So feel free to consult this thread.

1

1 Answers

1
votes

When using iAd banner and a uitableviewcontroller you can place it in the header of the tableview because the table viewcontroller controls the frame and bounds of the tableview. If you want to add the banner above or below the tableview you have to have a uiviewcontroller and add the uitableview to that so you can control the frame and bounds of the table view from your uiviewcontroller. The banner will remain where you put it and you have to animate the table views frame and bounds with the banner animating in and out of view.

There is no work around using uitableviewcontroller. And using uiviewcontroller you can only use a dynamic tableciew. The static table view is only in a uitableviewcontroller. I hope this helps!