Вот мой код для того, чтобы сделать летучую мышь крыльями и ответить на прикосновения.Помогите перекрыть анимацию?
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSArray * imageArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"Bat1.png"],
[UIImage imageNamed:@"Bat2.png"],
[UIImage imageNamed:@"Bat3.png"],
[UIImage imageNamed:@"Bat2.png"],
[UIImage imageNamed:@"Bat1.png"],
[UIImage imageNamed:@"Bat4.png"],
[UIImage imageNamed:@"Bat5.png"],
[UIImage imageNamed:@"Bat6.png"],
[UIImage imageNamed:@"Bat5.png"],
[UIImage imageNamed:@"Bat4.png"],
nil];
UIImageView * batView = [[UIImageView alloc] initWithFrame:
CGRectMake(0, 0, 80, 56)];
batView.animationImages = imageArray;
batView.animationDuration = 0.70;
[follower1 addSubview:batView];
[batView startAnimating];
[UIImageView beginAnimations:@"follow" context:nil];
[UIImageView setAnimationDuration:1];
[UIImageView setAnimationBeginsFromCurrentState:YES];
UITouch *touch = [touches anyObject];
follower1.center = [touch locationInView:self];
[UIImageView commitAnimations];
[batView release];
}
Проблема заключается в том, что после второго прикосновения анимации накладываются друг на друга так, после каждого прикосновения она выглядит как есть много летучих мышей под ним!