Thread safety of UIImage

后端 未结 6 927
一整个雨季
一整个雨季 2020-12-31 19:43

I know that Apple officially recommends UIKit to be used in the main thread only. However, I\'ve also heard claims that UIImage is thread-safe since iOS 4.0. I cannot find

6条回答
  •  北海茫月
    2020-12-31 20:28

    It is true that apple recommends using elements from the UIKIt on the main thread:

    Note: For the most part, UIKit classes should be used only from an application’s main thread. This is particularly true for classes derived from UIResponder or that involve manipulating your application’s user interface in any way.

    Since UIImage isn't derived from UIResponder, and you do not actually display it on the interface/screen. Then doing operations with UIImages on another thread should be safe.

    This is however based on my experience, I haven't seen any official documentation about it.

提交回复
热议问题