I want to share my ad banner across several view controllers, but I'm not sure how I should go about doing that. Everyone seems to be creating the AdWhirlView in their view controller, but then you have reload each time and the ad takes time to appear. I'd rather have it come in once and just share the ad view as the user navigates my view controllers.
Asked
Active
Viewed 562 times
1 Answers
1
You could instantiate the view inside your app delegate (or any other globally accessible object), assign it to a property and then access it from anywhere in your app by calling something like:
[[[UIApplication sharedApplication] delegate] myAdWhirlView]
The view being already instantiated, you could then add it to your superview and remove it at will, all while keeping it instantiated.

samvermette
- 40,269
- 27
- 112
- 144
-
Where do you handle AdWhirls delegate method viewControllerForPresentingModalView? – marimba May 16 '11 at 13:12
-
I'd have to see what the delegate methods do exactly but if your implementation is going to be similar for every view controller than maybe you can set the delegate to the application delegate as well? – samvermette May 16 '11 at 15:50
-
This works fine, I create the AdWhirlView and in each ViewController I simply set its frame and addSubview. Before the view appears its transparent so I just put my own ad beneath it. – May 18 '11 at 00:45