Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable animations for a view and all it's subviews temporarily?

I have some views with subviews, and there are animations going on. Before using shouldRasterize = YES I want to disable animations, so that all animation commands will be ignored inside that view hierarchy sub-branch.

Is there an easy way to do it?

like image 223
dontWatchMyProfile Avatar asked Dec 04 '11 00:12

dontWatchMyProfile


2 Answers

You can use next static method in UIView:

+ (void)setAnimationsEnabled:(BOOL)enabled

See reference for detail info

like image 130
Victor Avatar answered Oct 15 '22 10:10

Victor


As said by Victor, you can use the static method + (void)setAnimationsEnabled:(BOOL)enabled of UIView to disable animations. However, this will disable animations for all views after you call that method. You should remember to enable animations later. As of disabling animations for a specific hierarchy of views but no others, that is not possible.

like image 42
Rafael Steil Avatar answered Oct 15 '22 08:10

Rafael Steil