当前位置: 动力学知识库 > 问答 > 编程问答 >

sprite kit - Can you control when an Ad banner will appear?

问题描述:

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?

网友答案:

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

网友答案:

You've tagged your question with the iad 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: