简体   繁体   English

iphone cocos2d iAd问题

[英]iphone cocos2d iAd problem

we have an application built using cocos2d, the first class (scene) called from the app delegate is the levels class which then calls the game class (scene) according to user choice. 我们有一个使用cocos2d构建的应用程序,从应用程序委托调用的第一个类(场景)是关卡类,然后根据用户选择调用游戏类(场景)。 where should i write my iAd code and how ? 我应该在哪里编写iAd代码,怎么写? any help please. 请任何帮助。

I recently wrote a post about this issue (integrating iAd in a Cocos2d-x game) in my blog . 我最近在我的博客中撰写了有关此问题的文章(将iAd集成到Cocos2d-x游戏中)。 Take a look and ask me if you have any questions. 看一下,问我是否有任何问题。

My suggestion would be to look at AdWhirl, which would make your ads decoupled from the ad network. 我的建议是看一下AdWhirl,它将使您的广告与广告网络分离。

More can be found below. 可以在下面找到更多信息。

https://www.adwhirl.com/home/dev https://www.adwhirl.com/home/dev

我的理解是,您不能将CCLayer直接放入CCLayerCCScene (我希望这些是名称),您必须缩小场景才能将iAd放置在Cocos2d视图旁边。

To implement iAd add the import 要实施iAd,请添加导入

#import <iAd/ADBannerView.h>

If you initialize iAd in the AppDelegate, it will displayed everywhere. 如果您在AppDelegate中初始化iAd,它将在任何地方显示。 This is very easy to achieve. 这很容易实现。

ADBannerView* iAdView = [[ADBannerView alloc] initWithFrame:CGRectZero];
iAdView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
[[[CCDirector sharedDirector] openGLView] addSubview:iAdView];

For more information, look at apples programming guide http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/iAd_Guide/Introduction/Introduction.html 有关更多信息,请参阅Apple编程指南http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/iAd_Guide/Introduction/Introduction.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM