iAd本身很好用。当我点击iAd时,它会加载一个全屏广告。然后当我点击iAd时。然后点击我的开始游戏按钮,游戏中的UIImageView会自动沿着方向移动,具体取决于我点击广告的哪一侧。不知道为什么触摸iAd会影响UIImageView。我使用touchesBegan方法移动UIImageView。我该怎么做才能阻止这个iAd触摸影响UIImageView?
在VC.m中使用以下内容来集成iAd。
#pragma mark iAd委托方法
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[banner setAlpha:1];
[UIView commitAnimations];
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[banner setAlpha:0];
[UIView commitAnimations];
}
编辑:
我的touchesBegan
方法:
MoveLeft,moveRight,StopSideMove都是ViewController.h
中的BOOL值
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
moveLeft=NO;
moveRight=NO;
stopsideMove=YES;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch=[touches anyObject];
CGPoint point=[touch locationInView:self.view];
if (point.x <170) {
moveLeft=YES;
}
else
moveRight=YES;
}