2012-09-11 104 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