嗨,我想这样做,如果您触摸我放在视图上的图像,-(void)checkcollision 就会发生。-(void)checkcollision 发生了,但是当我触摸任何东西时。我怎么能说它只有在我触摸指定的图像时才有效。例如一个疙瘩:
IBOutlet UIImageView *pimple;
@property (nonatomic, retain) UIImageView *pimple;
这是touchesBegan代码
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [[event allTouches] anyObject];
[self checkcollision];
}
-(void)checkcollision {
if (label.text = @"0") {
label.text = @"1";
}
pimple.hidden = YES;
}