当我尝试在线程中执行时:
UITextView *aDescriptionView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 25, 50)];
我收到此错误:
bool _WebTryThreadLock(bool), 0x2819b0: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...
这里出了什么问题?我应该怎么办?我必须将其放在一个单独的线程中,因为它返回给我一个 UIView 对象。
最佳答案
您不得从主线程之外的任何线程访问 UI。曾经。
关于iphone - 在线程中初始化 UITextView ——导致问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4834537/