iphone - 在线程中初始化 UITextView ——导致问题

标签 iphone cocoa-touch uitextview nsthread

当我尝试在线程中执行时:

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/

相关文章:

ios7 - iOS 7-UITextView大小的字体以使所有文本适合 View (无滚动)

ios - 在自动布局中隐藏不断增长的 UItextview 的键盘。如何克服这个?

ios - 在数组中查找文本并返回索引号

ios - 在 Xcode 中从 App store 复制 iOS 应用程序更新过程

ios - 通过点击 2 个 API 来显示 TableView 数据的网络请求 - iOS

objective-c - 返回指向不同对象的指针的方法是否会自动分配和初始化其他对象?

ios - 已释放对象的校验和不正确 - 如何在设备上进行故障排除?

ios - UIGraphicsGetImageFromCurrentImageContext 泄漏

iphone - 创建简单 UIAlertView 时的 EXC_BAD_ACCESS

iphone - iPhone 中的 Omniture 追踪