您的位置:首页 > 移动开发

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

2016-12-15 16:29 429 查看
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控件的操作
}];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios 线程
相关文章推荐