UIWebView in multithread ViewController

前端 未结 8 847
日久生厌
日久生厌 2020-12-24 09:38

I have a UIWebView in a viewcontroller, which has two methods as below. The question is if I pop out(tap back on navigation bar) this controller before the second thread is

8条回答
  •  一向
    一向 (楼主)
    2020-12-24 10:03

    Here is some code to run UIKit elements on the main thread. If you're working on a different thread and need to run a piece of UIKit code, just put it inbetween the brackets of this Grand Central Dispatch snippet.

    dispatch_async(dispatch_get_main_queue(), ^{
    
        // do work here
    
    });
    

提交回复
热议问题