iphone - gesture not working on animated view
- by Mike
I have this animated view and a gesture assigned to it...
[self.view setUserInteractionEnabled:YES];
UIImageView *sequence = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"frame0.png"]];
[sequence setUserInteractionEnabled:YES];
sequence.center = CGPointMake(centroX, centroY);
NSMutableArray *array = [[NSMutableArray alloc] init] ;
for (int i=0; i<30; i++) {
UIImage *oneImage = [UIImage imageNamed:[NSString stringWithFormat:@"frame%d.png",i]];
[array addObject:oneImage];
}
sequence.animationImages = array;
sequence.animationDuration = 1.0;
sequence.animationRepeatCount = 1;
[self.view addSubview:sequence];
[sequence release];
sequence.startAnimating;
sequence.image = [UIImage imageNamed:@"frame29.png"];
// doSomething never runs when I tap the image... why?
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(doSomething)];
[singleTap setDelegate:self];
[singleTap setCancelsTouchesInView:NO];
[singleTap setDelaysTouchesEnded:NO];
[sequence addGestureRecognizer:singleTap];
[singleTap release];
The gesture is never called... why?
I have no other gesture associated anywhere.
thanks for any help.