Explicitly disabling UIView animation in iOS4+

P i picture P i · Mar 26, 2011 · Viewed 22.9k times · Source

I have been reading that Apple recommends to use block-based animations instead of CATransaction

Before, I was using this code to disable animations:

[CATransaction begin];
[CATransaction setDisableActions: YES];
// !!! resize
[CATransaction commit];

Is there a new recommended method to do this, or is this still okay?

Answer

Joshua Weinberg picture Joshua Weinberg · Mar 26, 2011
[UIView setAnimationsEnabled:NO];
//animate here
[UIView setAnimationsEnabled:YES];