Mani
Mani

Reputation: 1841

Can i change Google AdMob Ads's navigation bar position in ios?

Can i change Google AdMob Ads's navigation bar position in ios?

Can i change navigation bar position?

and how to check google admob is on screen or not (dismiss) ?

Upvotes: 0

Views: 695

Answers (1)

Natan R.
Natan R.

Reputation: 5191

As the admob is incorporated to your code as library and they haven't provided any API for moving this bar (a UIToolbar, not a UINavigationBar), you can't change it.

I think they don't have any property to check if the screen is being presented or not. But you can set a BOOL in your class, and set it to YES or NO in the GADBannerViewDelegate methods:

-(void)adViewWillPresentScreen:(GADBannerView *)bannerView;
-(void)adViewDidDismissScreen:(GADBannerView *)bannerView;
-(void)adViewWillDismissScreen:(GADBannerView *)bannerView;
-(void)adViewWillLeaveApplication:(GADBannerView *)bannerView;

To understand it, you will need to read a little bit about delegation in Objective-c. But I will try: In your class interface, you put:

@interface MyViewController : UIViewController <GADBannerViewDelegate>
{
    BOOL isPresentingBanner;
    GADBannerView *myBanner;
}

In your class implementation, after you init the delegate, define the delegate:

myBanner.delegate = self;

And you implement the delegate methods:

-(void)adViewWillPresentScreen:(GADBannerView *)bannerView
{
    NSLog(@"adViewWillPresentScreen");
    isPresentingBanner = YES;
}

-(void)adViewDidDismissScreen:(GADBannerView *)bannerView
{
    NSLog(@"adViewDidDismissScreen");
    isPresentingBanner = NO;
}

-(void)adViewWillDismissScreen:(GADBannerView *)bannerView
{
    NSLog(@"adViewWillDismissScreen");
}

Upvotes: 1

Related Questions