touchesBegan question for iPhone/iPad App
I have an App and in my touchesBegan, I move an image to another view. After I move the image I replace the original image with the same image with an alpha of .5.
However, the the user can still touch the 'dimmed' image and move it. I do not want them to be able to select any of the 'dimmed' images. I thought maybe I could cancel the touches begin when the user touches the first time, but I am not sure how to cancel it.
UPDATE: As per the suggestions posted, I have done this in my touchesBegan:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{ UITouch * touch = [touches anyObject]; if (self.alpha >= 1) { // DO STUFF } else self.userInteractionEnabled = NO; }
However, that does not appear to solve the problem as I can still drag the image and drop it.
Any other ideas would be appreciated!! 开发者_运维技巧
Thanks
you can disable user interaction on any view using
view.userInteractionEnabled = NO;
Try this...
self.userInteractionEnabled = NO;
精彩评论