這裏的櫃檯是我的代碼:問題與衝突
-(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;
}
我有一個CADisplayLink(60幀)上detectCollision。 我想增加一個「計數」的每一次「imageView」與「中心」碰撞,但我的問題是,計數增量太快,每次有一個碰撞它增加近100或200,我不知道爲什麼。我該如何解決這個問題?
沒有它不工作時,計數器增加非常快,直到ImageView的不接觸中心 –
你初始化intersectFlag爲NO在初始化 – ArunGJ
沒有,但我從來沒有使用BOOL,我怎麼能初始化intersectFlag爲NO在init –