这是我的代码:
-(void)collision {
if(CGRectIntersectsRect(imageView.frame,centre.frame)){
[imageView removeFromSuperview];
count++;
label.text= [NSString stringWithFormat:@"%d", count];
}
}
- (void)viewDidLoad {
[super viewDidLoad];
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(collision) userInfo:nil repeats:YES];
count=0;
scale=1;
}
使用此代码我的计数增加超过一个有时34,有时74或70,为什么?