Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlaying an iAd banner onto screen instead of resizing screen

I've made two iPhone apps using Swift and just implemented the iAd Framework and added self.canDisplayBannerAds = true in my viewDidLoad() under GameViewController().

When ads appear in my game, the game screen resizes so that everything is still visible. When this happens, the game screen gets shrunken vertically and the game becomes much harder for the player.

How can I overlay the banner ad onto the bottom of the screen without resizing the game screen? I want the bottom part of the game screen to simply not be visible.

like image 969
Tom Keegan Avatar asked Apr 21 '15 06:04

Tom Keegan


1 Answers

As far as I know the issue is in the self.canDisplayBannerAds = true

This code worked perfectly for me! Please make sure, that you name your AdBannerView "adBanner" ( var adBanner = ADBannerView() )

Include this code in viewDidLoad

        adBanner = ADBannerView()
        adBanner.frame = CGRectZero
        adBanner.delegate = self
        self.adBanner.frame = CGRectMake(0, self.view.frame.size.height-self.adBanner.frame.size.height, self.adBanner.frame.size.width, self.adBanner.frame.size.height)
        adBanner.backgroundColor = UIColor.clearColor()
        self.view.addSubview(adBanner)
like image 170
Devapploper Avatar answered Nov 11 '22 05:11

Devapploper