As I put the finishing touches on the Swift rewrite of my Lists zApp, I found it a lot harder to put a simple iAd banner on the bottom of my App than it should be. All I really wanted was:
After reading a number of blog and forum posts, I finally found a simple answer, and it makes sense too. Apple doesn’t want displaying iAds to be hard. Yes, you can drag the banner Ads to your storyboard and do fancy manipulation through code, or draw view CGRect all over the screen through code, but all you really need to do is place the following Swift code in any view controller’s “viewDidLoad” function where you want the banner ad displayed.
1 |
self.canDisplayBannerAds = true |
self.canDisplayBannerAds = true
That’s it! Anywhere you want a banner ad at the bottom of your App, put that code in the View Controller. You can send me 0.1% of each ad click as a thank you.