IOS - Updating tags during transition animations?

I have a UIView on a screen that contains several shortcuts. I'm trying to have a transition where the view flips, and as soon as I'm halfway through nimation, I want to be able to update the labels. How can i achieve this?

[UIView transitionWithView:self.myView duration:.7 options:UIViewAnimationOptionTransitionFlipFromBottom animations:^{ // It doesn't update the labels here, until I scoll the tableview (containing the view) //[self.myView update]; } completion:^(BOOL finished){ // It doesn't look nice here because it doesn't look smooth, the label flashes and changes after the animation is complete //[self.myView update]; }]; 
+4
source share
1 answer

The problem was that I had to enable Rasterize, which did not allow the content to be updated during the animation. The solution was to disable rasterization before the animation and enable it after the animation was completed.

The reason I didn't get rid of the rasterization is because the view is inside the tableView, and the rasterization still helps when scrolling through the View table.

 self.layer.shouldRasterize = NO; [UIView transitionWithView:self duration:animationDuration options:UIViewAnimationOptionTransitionFlipFromBottom animations:^{/*update the content here, I did it outside of the transition method though*/} completion:^(BOOL finished){ if (finished) { self.layer.shouldRasterize = YES; } }]; 
+4
source

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


All Articles