views:

40

answers:

1
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
...
[UIView commitAnimations];

For example I need to animate frame's width conditionally, along with the rest of other modifications which are mandatory. The reason I can't put the code out of this block, because there is a function call within the block. How would I exclude some operations from within animation block?

A: 

Checkout setAnimationsEnabled:

[UIView beginAnimations:@"Ani" context:NULL];
[UIView setAnimationDuration:1.0];
  // some animations
[UIView setAnimationsEnabled:NO];
  // animations disabled (put exclusions here)
[UIView setAnimationsEnabled:YES];
  // some more animations
[UIView commitAnimations];  
ohho
I did before writing and it says: `Use of this method is discouraged in iOS 4.0 and later. You should use the block-based animation methods instead.`
Michael
It's discouraged, but still supported ;-)
ohho
Yea, if there is no other way I will have to stick with it...
Michael