开发者

problem with the counter of a collision between two images

here is my code :

-(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;
}

with this code my count increase of more than one sometimes 34 and sometime 74 or 70 , why ?


Stops the receiver from ever firing again and requests its removal from its run loop.

 - (void)invalidate

class reference

helpful question

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜