Admob BannerView float over PFQueryTableViewController

169 views Asked by At

I'm trying to get ADBanner at the bottom above UITabBarController / float above UITabBarController as I'm using PFQueryTableViewController I'm getting the ADBanner as a part of TableViewCell and the ADBanner is scrollable like the table. And as I'm using PFQueryTableViewController I can't add view to my table . as it is scrollable . The following code I'm using inside viewDidLoad method

let bannerView: GADBannerView = GADBannerView(adSize:kGADAdSizeSmartBannerPortrait)

    bannerView.frame.origin = CGPointMake(0, self.view.frame.size.height - 49 - 50)
    bannerView.adUnitID = "ca-app-pub-5819113245629378/9884937047"
    bannerView.rootViewController = self
    self.view.addSubview(bannerView)
    bannerView.loadRequest(GADRequest())

enter image description here

Update: This is how I'm adding the containerView.

enter image description here

Now the containerView is not visible

1

There are 1 answers

10
Johnykutty On BEST ANSWER

PFQueryTableViewController is a subclass of UITableViewController, So if you add any subview to its view whites a tableview will float based on the content of its tableview;

You can try by adding it a view controller instead table view. But in your case it is PFQueryTableViewController, My opinion is to add one view controller and add an embedded view controller segue to your PFQueryTableViewController.. Then add your banner to your first view controller

UPDATE

If you are using storyboard, you can try as follows. Also try to use auto layout instead of fixed frame.

enter image description here