0

I have been doing a lot of cut-and-paste programming to put iAd into different apps. Is it possible to encapsulate it somehow?

William Jockusch
  • 26,513
  • 49
  • 182
  • 323
  • can you help in this http://stackoverflow.com/questions/5947552/how-to-display-test-iad-banner-in-the-simulator – ajay May 11 '11 at 16:05

1 Answers1

1

Of course.

You can create a view controller, and the view it manages is the iAd view.

Have this view controller implement the iAd delegate protocols and then you can create an instance of this view controller and add its view as subviews of other views throughout your app.

Simples :)

Jasarien
  • 58,279
  • 31
  • 157
  • 188
  • But you are only supposed to have one view controller visible at any given time. – William Jockusch Dec 27 '10 at 21:11
  • You can have as many view controllers as you like. The views they manage can be as big or small as you like, provided they fit on the screen (with the exception of UIScrollView). You're perhaps confusing displaying a view modally or via a navigation controller, but there is definitely no restriction to the amount of view controllers or views that you have on screen at any one time. – Jasarien Dec 27 '10 at 21:24
  • You appear to be correct, though I could swear Apple used to say not to do this, and their view controller programming guide still has (perhaps outdated) text saying to have the view of only one view controller visible at any given time. At any rate, I used basically your solution, but with a UIView subclass. It seems to work fine. – William Jockusch Dec 28 '10 at 03:33