Thread safety of UIImage

后端 未结 6 819
一整个雨季
一整个雨季 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:17

    It looks like Apple have updated their documentation since the earlier answers here were posted. According to the most up-to-date documentation, it is safe to create and use UIImage instances from any thread:

    Because image objects are immutable, you cannot change their properties after creation. Most image properties are set automatically using metadata in the accompanying image file or image data. The immutable nature of image objects also means that they are safe to create and use from any thread.

    https://developer.apple.com/reference/uikit/uiimage

提交回复
热议问题