Can you control when an Ad banner will appear?

53 views Asked by At

Id like to add Ad banners to my game, but they would really be distracting during actual game play. Can you control when the banner will be displayed? IE: the end game screen that gives you the option to restart?

2

There are 2 answers

2
Pierce On

Yes you can, in fact most mobile advertisement platforms try to encourage you to do it like that. Check out interstitial ads with something like Google AdMob

0
Daniel Storm On

You've tagged your question with the tag but iAd has been discontinued. A popular alternative is Google's AdMob.

AdMob's GADBannerView is a subclass of UIView so you can hide and show it just like any other UIView. For example:

let myBannerAd = GADBannerView()

func startGame() {
    myBannerAd.hidden = true
}

func gameOver() {
    myBannerAd.hidden = false
}

Most ad networks also come with delegate methods to track ad events.