iPhone AdWhirl - How to share view across several view controllers
I want to share my ad banner across several view controllers, but I'm not sure how I shou开发者_如何学Cld 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.
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.
精彩评论