2012-09-11 62 views
4

我需要在块中设置setAnimationBeginsFromCurrentState。我找不到任何文档或示例如何操作。基于UIView块的动画重绘

我需要转换成这样:

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationBeginsFromCurrentState:YES]; //The problem 
[UIView setAnimationDuration:kKeyboardAnimationDuration]; 
[self.view setFrame:viewFrame]; 
[UIView commitAnimations]; 

成块,以及设置setAnimationBeginsFromCurrentState属性。

回答

7

当使用基于块的UIView动画时,您可以将UIViewAnimationOptionBeginFromCurrentState传递给动画选项。

[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 
    [self.view setFrame:viewFrame]; 
}completion:^(BOOL done){ 
    //some completition 
}]; 
+0

啊!为什么我没有看到:S谢谢你的帮助! – random