WoodenKitty
WoodenKitty

Reputation: 6529

iPhone animations - animating one things causes other things to be animated

I've animated moving a UIView as follows:

CGRect rightPop =  CGRectMake(167, 270, 142, 73);       
[UIView beginAnimations:nil context:NULL];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.4];
[rightToast setFrame:rightPop];
[UIView commitAnimations];

The animation occurs just fine, but it causes other parts of the app to become animated (eg, navigation bars etc).

Does anyone know how I can stop the other animations?

Upvotes: 1

Views: 728

Answers (1)

Tom Harrington
Tom Harrington

Reputation: 70936

It's happening because animation blocks can be nested. You're opening two of them via beginAnimations, but only closing one via commitAnimations. The second animation block is still open, so extra animations are not surprising. I don't know why you're calling beginAnimations twice, it's not necessary. Drop that and things should work normally.

Upvotes: 3

Related Questions