Search code examples
iosobjective-ciadadbannerview

How to pause iAd banner?


I want to simply pause the iAd banner in my app. When the user double clicks the home button to go to the multitasking screen, I made it so the app pauses itself which works perfectly fine. But the iAd banner keeps animating itself which looks kind of weird. A live iAd banner in a frozen app...

So how can I programmatically pause an iAd banner (ADBannerView)?

Or should I just remove it until the app is in the foreground again?


Solution

  • Since it's just a UIView, it's probably best to just set it's 'hidden' property to YES in viewWillDisappear (or viewDidDisappear) and then unhide it in viewWillAppear.

    Another approach would be to grab a screencapture of the rectangle representing the banner, overlay an UIImageView on top of the banner and display the screen cap there. But I think that's a bit overkill.