0

I am using cocos2d 3.0.

In AppDelegate class I have implemented admob and it works fine, but it is always on the screen. But I want admob to be hidden during the main scene and to appear when it is game over. In AppDelegate.h I have

#import <UIKit/UIKit.h>
#import "cocos2d.h"

#import "GADBannerView.h"
typedef enum _bannerType
{
kBanner_Portrait_Top,
kBanner_Portrait_Bottom,
kBanner_Landscape_Top,
kBanner_Landscape_Bottom,
}CocosBannerType;

#define BANNER_TYPE kBanner_Portrait_Top

@interface AppController : CCAppDelegate
{

CocosBannerType mBannerType;
GADBannerView *mBannerView;
float on_x, on_y, off_x, off_y;
}


 -(void)hideBannerView;
 -(void)showBannerView;

In MainScene class I've tried to write

mBannerView.hidden = YES;

but it is said that mBannerView is undeclared identifier.

I guess i should somehow use -(void) hideBannerView, but I don't know how.

Could you please tell me what should I do to hide admob on certain scenes.

A.Ts
  • 1

1 Answers1

0

You can move banner up and down to hide.

AppController *app = (AppController*)[UIApplication sharedApplication].delegate;
[app hideBannerView];

Here is Full Source: Cocos2d v3 Admob Sample

Guru
  • 21,652
  • 10
  • 63
  • 102