Redrawing UIView Block-Based Animation

I need to set setAnimationBeginsFromCurrentState in a block. I can not find any documentation or example on how to do this.

I need to convert this:

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

In the block, and also set the setAnimationBeginsFromCurrentState property.

+4
source share
1 answer

When using UIView block animation UIView you can pass UIViewAnimationOptionBeginFromCurrentState to the animation parameters.

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

Source: https://habr.com/ru/post/1433641/


All Articles