I`m wondering if is possible to write different UIView animation at the same time. I trying to animate two Apple style flip counters using sprite animation simultaneously. Each flip counter has his own animation. The problem is that the second flip counter start to run when the first counter finish.
EDITED Twice: Here is the code: https://dl.dropbox.com/u/1348024/MultipleFlipCounters.zip
There are two simple classes “FlipCounterView.m” and “CounterViewController”. Tapping the screen “CounterViewController” will start the animation. Thanks!
EDITED:
Relevant code added.
Apple style flip counter sprite animation is done FlipCounterView class.
- (void)viewDidLoad{
[super viewDidLoad];
flipCounter1 = [[FlipCounterView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[flipCounter1 add:10];
[self.view addSubview:flipCounter1];
flipCounter2 = [[FlipCounterView alloc] initWithFrame:CGRectMake(0, 120, 200, 200)];
[flipCounter2 add:10];
[self.view addSubview:flipCounter2];
}
Tapping screen:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[UIView animateWithDuration:0.5
animations:^{
//this method made an sprite animation on flipCounter1
[flipCounter1 distributedAdd:150 overSeconds:0 withNumberOfIterations:3];
}];
[UIView animateWithDuration:0.5
animations:^{
//this method made an sprite animation on flipCounter2
[flipCounter2 distributedAdd:150 overSeconds:0 withNumberOfIterations:3];
}];
}