How to add iAd in Cocos-SpriteBuilder(如何在 Cocos-SpriteBuilder 中添加 iAd)
问题描述
我正在使用 SpriteBuilder(与 Cocos2d v3.0 集成).我构建了一个应用程序,现在我想在最顶部放置一个 iAd,当我调用它时它会弹出,当我告诉它时它会隐藏.最简单的方法是什么?
I am using SpriteBuilder (which integrates with Cocos2d v3.0). I built an app and now I want to put in an iAd at the very top that pops up when I call it, and hides when I tell it to. What's the simplest way to do this?
请记住,我将 SpriteBuilder 与 Cocos2d 一起使用.仅仅因为我使用 SpriteBuilder 并不意味着我也没有使用 Xcode 5.我也完全参与了 Xcode.SpriteBuilder 不会为我编写代码,我会这样做.
Keep in mind I am using SpriteBuilder with Cocos2d. And just because I am using SpriteBuilder does not mean I am not using Xcode 5 as well. I am fully involved in Xcode as well. SpriteBuilder does not write the code for me, I do that.
推荐答案
将 iAd 框架添加到您的依赖项中.
Add iAd framework to your dependencies.
在游戏场景的头文件中,添加 ADBannerViewDelegate,例如:
In your header file for your game scene, add the ADBannerViewDelegate, for instance:
在你的实现文件中,添加实例变量_bannerView:
In your implementation file, add the instance variable _bannerView:
最后,插入 iAD 代码(通过一些 cocos2d 调整).这是我对带有顶部横幅的纵向模式游戏的实现.没有 hide 方法,但很容易实现.
And finally, insert the the iAD code (with some cocos2d tweaks). Here's my implementation for a game in portrait mode with a top banner. There's no hide method, but it's pretty easy to implement.
这篇关于如何在 Cocos-SpriteBuilder 中添加 iAd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!