线程安全的 UIKit 方法
我试图找出 iOS 4.0 上的 UIKit 中到底哪些方法(名称!)变得线程安全。
我搜索了苹果的文档但收效甚微。例如,使用 imageNamed: 创建的 UIImage
在其他线程上使用是不安全的(它偶尔会从主线程中抛弃它的 CGImage
),而 imageWithCGImage可能是(?)。另外,我还看到声称
UIColor
可以安全地在主线程以外的线程上使用。
是否有一些明确的指导来说明哪些方法是安全的,哪些方法是不安全的?
编辑: 有趣的是 UIKit 类可以在单独的线程上使用,例如 UIImage、UIColor 等。
I'm trying to find out exactly what methods (names!) became thread safe in UIKit on iOS 4.0.
I've searched through Apple's docs with little success. For instance a UIImage
created with imageNamed: is not safe to use on other threads (it will occasionally jettison its CGImage
from the main thread), while imageWithCGImage
might be(?). Also, I've seen claims that UIColor
is safe to use on threads other than the main thread.
Is there some definite guide as to which methods are safe which ones isn't?
Edit:
What's interesting is UIKit classes that is interesting to use on separate threads, such as UIImage
, UIColor
etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自苹果的 文档:
因此,您确实不应该与
UIKit
中的任何内容进行交互。 code> 在后台线程上。From Apple's documentation:
Therefore, you really shouldn't be interacting with anything in
UIKit
on a background thread.