3

I am making a iPhone app, I am currently using iAd's in my view's. I've read something about apple recommending to share the adbanner's through out the view's. How can i do this because I have read the apple documentation and it was not clear enough and i was confused, please help me, if their are any tutorials please tell me or just answer and point me in the right way. Currently I have a ad for every view controller and it runs nice but it comes with a error: Too many active banners (10). Creation of new banners will be throttled. Please help, i am using storyboards and the latest Xcode :) thanks

user1483652
  • 799
  • 1
  • 9
  • 16
  • What kind of container view are you using for your navigation? If it's a navigation controller, you can add the banner as subview of that. You must ensure that the banner view stays on top regardless of what child view controllers are pushed. Alternatively, you could create a second UIWindow on top of the default one and add the banner as subview of that. That way, it will always stay on top of all your other views (which reside in the normal, bottom window). – Nicolas Miari Aug 05 '12 at 17:55

2 Answers2

2

The way I do it is use a Singleton class that creates the adView, this way you only ever get 1 adView. Then in your viewDidAppear methods of all your ViewControllers you simply add the adView to your view.

You can see my code in the accepted answer here although that is for an AdWhirl ad view, it shouldn't be too difficult to change it for an iAd ad view.

Community
  • 1
  • 1
Darren
  • 10,182
  • 20
  • 95
  • 162
0

This is the perfect case for a singleton. Many have simply made a subclass of ADBannerView, which can then be added to your view in -viewDidLoad (or -viewDidAppear with the proper precautions taken) and removed in -viewDidDisappear for each View Controller.

CodaFi
  • 43,043
  • 8
  • 107
  • 153