How to add BannerViewController

| | August 18, 2015

I have a project built off the classic Master Detail template provided out of the box by Xcode. I am trying to incorporate the iAdSuite BannerViewController with out much success.

I have added BannerViewController.m & .h to my project, but I’m struggling to get my app to invoke the viewDidLoad in BannerViewController. I’ve been through the TabbedBanner sample pretty extensively and still don’t see where BannerViewController is “tied” in.

Tried adding BannerViewController as a child view controller

BannerViewController *vbc = [[BannerViewController alloc] init];
[navigationController addChildViewController:vbc];

This code produces a tragic ending.

Any insight into this sample code or hints where to find additional info on using a shared banner would be appreciated.

One Response to “How to add BannerViewController”

  1. In storyboard: add a new view controller, set its class to bannerViewController, & add a container view to that VC. A second VC will be added when you add the container view, delete it.

    Delete the segue between the root Navigation Controller and the table view controller.

    Add a ‘root view controller segue’ between the Navigation Controller and container, view and an ’embed segue’ between the container view and table view.

    You will need to tweak the frame adjustments code in bannerViewController->viewDidLayoutSubviews to take account of the navigation bar in the navigation controller. That will get you banner ads in your table view, I have yet to figure out how to get them to show in the detail view.

    Good luck.

Leave a Reply