IPhone lost all UI transition animation

Currently, I am facing a problem somehow, the application has lost all these artistic user interface animations, for example, page turning, pop-up warning window, pop-up action window, etc. This means that all of these interfaces will be displayed immediately without any transitional animation. It looked very strange.

Firstly, the application will run smoothly until something causes the problem above, and after that just restart the application or kill the application, this will stop the problem.

There are no error messages or any hints that I can figure out what could be the cause. Have any of you come across a similar problem as above? Please share with me how I can solve the problem above. Thanks.

+6
source share
1 answer

Animation can be turned off for the entire application whenever an attempt is made to animate representations in a background thread, for example. by calling one of the UIView animateWithDuration:animations: method families of the class from the background thread. Be sure to update the user interface of the application only from the main thread.

You can check if the code works in the main thread by testing [NSThread currentThread].isMainThread , and you can make sure that it works on the main thread, for example:

 dispatch_async(dispatch_get_main_queue(), ^(void) { // Your code }); 

Alternatively, make sure that you do not call [UIView setAnimationsEnabled:NO] anywhere, as this will also disable animation for the entire application.

0
source

Source: https://habr.com/ru/post/947007/


All Articles