我有一个问题。我正在使用动画 block ,但第二个动画与第一个动画同时进行动画处理。
这是我的代码。
[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];
}
}]
提前致谢..
最佳答案
Maddy 告诉您该怎么做。嵌套 block 的语法很难理解,所以作弊:
[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);
}
];
}
关于ios - 请帮助我的动画不工作 ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22494924/