Search code examples
iosobjective-csprite-kitiad

Detect and ignore touches on iAd banners


I have a Sprite Kit game that first displays a menu screen. The game starts when you tap anywhere on the screen. I am displaying iAd's. The problem I have is when a user taps the iAd banner to view the add, GameScene is responding to the tap and starting the game. Ideally I want to detect that the touch was on the iAd banner and not start the game in this case.

GameScene.m

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

    // I dont want to start game if the touch was on the iAd Banner
    NSLog(@"Touch detected - Start the game....");

    [self startGame];
}

Solution

  • use a UITapGestureRecognizer instead. Check if recognizer.view != adBanner