开发者

iphone cocos2d iAd problem

we have an applicat开发者_如何学Pythonion 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. where should i write my iAd code and how ? any help please.


My suggestion would be to look at AdWhirl, which would make your ads decoupled from the ad network.

More can be found below.

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


My understanding is that you can not put UIViews directly into CCLayer, or CCScene (i hope those are the names), you will have to shrink your scene in order to put the iAd beside your Cocos2d view.


To implement iAd add the import

#import <iAd/ADBannerView.h>

If you initialize iAd in the AppDelegate, it will displayed everywhere. 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


I recently wrote a post about this issue (integrating iAd in a Cocos2d-x game) in my blog. Take a look and ask me if you have any questions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜