Nicholas Whitley
Nicholas Whitley

Reputation: 81

Banner ad not going away

I'm calling in a RevMob banner ad into my main menu. If I have the if statement in the "handleNotification" method alone it calls no problem. But I want the banner to go away after I hit play so I put in the else statement. With the else statement in it doesn't show the ad at all.

- (void)handleNotification:(NSNotification *)notification
{
if ([notification.name isEqualToString:@"showAd"]) {
        _bannerWindow = [[RevMobAds session] banner];
        [_bannerWindow showAd];

} else ([notification.name isEqualToString:@"hideAd"]); {
    _bannerWindow = [[RevMobAds session] banner];
    [_bannerWindow hideAd];
}
}

In my main menu "initWithSize" method I use the following to call the ad:

[[NSNotificationCenter defaultCenter] postNotificationName:@"showAd" object:nil];

When my scene transitions into my game scene(when I hit play) I have this in the game scene's "initWithSize" method:

[[NSNotificationCenter defaultCenter] postNotificationName:@"hideAd" object:nil];

Upvotes: 0

Views: 60

Answers (1)

26.565
26.565

Reputation: 926

- (void)handleNotification:(NSNotification *)notification
{
    if ([notification.name isEqualToString:@"hideAd"]) {
        _bannerWindow = [[RevMobAds session] banner];
    [_bannerWindow hideAd];
    }else if ([notification.name isEqualToString:@"showAd"])//You should use else if 
        {
        _bannerWindow = [[RevMobAds session] banner];
        [_bannerWindow showAd];
    }
}

Upvotes: 1

Related Questions