presentviewcontroller mode switching is very slow

The switching of the presentviewcontroller mode is very slow, and the effect is displayed from the bottom

to When pushing, it feels much faster, and there is not much that pause.

Solution:

put the code of your page jumping into this:

dispatch_async(dispatch_get_main_queue(), ^{

        //Jump interface

    });




Recently, I also found this problem. It takes about 5 seconds to jump, which is very depressing. After adding the above GDB thread, it is normal immediately. So the possible reason is

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion

This method may not be loaded on the UI thread. I don't know what Apple has changed in this method.

Note that before the GDB thread is added, the code for the jump interface is processed in the UI thread, so there is no problem of jumping in the child thread.


Solution: Just performSelector, you can do nothing in this function, the purpose is to wake up the main thread for execution.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326859314&siteId=291194637