SaleenS7
SaleenS7

Reputation: 402

How to use self.view in cocos2d?

I am implementing Flurry ads into my app, and I've come across an issue that I've gotten stumped on.

The integration of a banner ad is as follows:

[FlurryAds setAdDelegate:self];

[FlurryAds fetchAndDisplayAdForSpace:@"BANNER_MAIN_VIEW" view:self.view size:BANNER_BOTTOM];

The part that I can't figure out is the view parameter. Since cocos2d does not use UIViews, how can I make it work? I've created a view like this UIView *mainView = [[UIView alloc]init]; but I'm not sure how to apply it to a CCScene, since I can't use addChild.

Upvotes: 2

Views: 196

Answers (1)

Allen S
Allen S

Reputation: 1042

Did you try (if using cocos2d 3.0):

UIView* view = [CCDirector sharedDirector].view;

[FlurryAds setAdDelegate:self];
[FlurryAds fetchAndDisplayAdForSpace:@"BANNER_MAIN_VIEW" view:view size:BANNER_BOTTOM];

Upvotes: 4

Related Questions