且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获得“此应用程序正在从后台线程修改自动布局引擎".错误?

更新时间:2022-12-09 11:02:03

好的-找到了答案.需要将其放置在不同的线程中,该线程允许UI在执行完线程功能后立即进行更新:

Okay - found the answer. It needs to be placed inside a different thread that allows the UI to update as soon as execution of thread function complete :

 DispatchQueue.main.async {
    // Update UI
 }

迅速版本< 3

dispatch_async(dispatch_get_main_queue(){
    // code here
})

Objective-C版本

dispatch_async(dispatch_get_main_queue(), ^{
    // code here
});