Reputation: 285
I have an issue. I'm using animation block, but the second animation simultaneously animates with the first animation.
This is my code.
[UIView animateWithDuration:2.0f
delay:0.0f
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.scrollView.frame = CGRectMake(63, 59, 437, 289);
}
completion:^(BOOL finished){
if (finished) {
[UIScrollView beginAnimations:nil context:NULL];
[UIScrollView setAnimationDuration:0.6];
self.scrollView.frame = CGRectMake(63, 2, 437, 289);
[UIScrollView commitAnimations];
}
}]
Thanks in advance..
Upvotes: 1
Views: 198
Reputation: 34829
Add an NSLog that displays self.scrollView.frame
before the first animation. If you don't actually change anything in an animation, I think it will just get skipped.
Upvotes: 0
Reputation: 131418
Maddy told you what to do. The nested block syntax can be hard to figure out, so cheat:
[UIView animateWithDuration:2.0f
delay:0.0f
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.scrollView.frame = CGRectMake(63, 59, 437, 289);
}
completion:^(BOOL finished){
if (finished)
{
[self secondAnimation];
}
}]
- (void) secondAnimation:
{
[UIView animateWithDuration: 0.6
animations: ^
{
self.scrollView.frame = CGRectMake(63, 2, 437, 289);
}
];
}
Upvotes: 2