views:

79

answers:

1

I've got quite a few UIView-based Animations going on most of the time in my app. I want to be able to handle all device rotations, but it's always a performance hit when you trigger the device rotation when there's already an animation going on.

I wonder what's the best practice for cases like this?

Shall I subclass all my UIView elements to skip all animation instances to the final frame when there's a device rotation? Or shall I disable device rotation when there's animation? (Seems to be a bad idea.)

Looking forward to your thoughts. Thanks. :)

A: 

You can disable expensive animation before rotation and reenable them after rotation is complete. See UIViewController's willRotateToInterfaceOrientation:duration: and didRotateFromInterfaceOrientation: methods in documentation for more details.

Vladimir
Thanks. To continue with that, what's the most common way to disable/re-enable animation? I tried UIView's setAnimationsEnabled: , but it removes the rotation transition animations as well. I should use CALayer to handle that case by case? :)
Liz
Sorry don't know, may be you really have to use CALayer animations for that
Vladimir