【发布时间】:2011-07-23 11:13:09
【问题描述】:
这是我的代码:
-(void)detectCollision{
imageView.center = CGPointMake(imageView.center.x + X, imageView.center.y + Y);
if(CGRectIntersectsRect(imageView.frame,centre.frame)){
label.text= [NSString stringWithFormat:@"%d", count];
++count;
}
我在detectCollision 上有一个CADisplayLink(60fps)。 每次“imageView”与“中心”发生碰撞时,我想增加一个“计数”,但我的问题是计数增加太快,每次发生碰撞时它都会增加接近 100 或 200,我不知道为什么.我该如何解决这个问题?
【问题讨论】:
标签: iphone xcode uiimageview collision-detection counter