iOS - 解决This application is modifying the autolayout engine from a background thread

来源:互联网 发布:伪娘 知乎 编辑:程序博客网 时间:2024/06/07 20:07
This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.

原因

在子线程中进行了对UI控件的操作。比如在子线程下添加了一个UIView,而UI控件的操作都必须在主线程下~

解决方案

回到主线程更新UI

[[NSOperationQueue mainQueue] addOperationWithBlock:^{    // 进行UI控件的操作}];
0 0