UIKit drawing is thread safe: how do you get a graphics context?

后端 未结 1 1153
别跟我提以往
别跟我提以往 2020-12-29 13:10

So, as mentioned in this answer and in the iOS 4.0 release notes, UIKit now has some thread-safe drawing facilities:

Drawing to a graphics context in

相关标签:
1条回答
  • 2020-12-29 13:33

    My belief, based on some experience trying it and based on various documents, is that the docs for UIGraphicsPushContext() are incorrect.

    I believe UIGraphicsPushContext() is in fact thread safe. The particular indication that this is true is QA1637, which says "Beginning with iOS 4.0, drawing to a graphics context in UIKit is thread-safe. This includes accessing and manipulating the current graphics stack, drawing images and strings, and usage of color and font objects from secondary threads." (emphasis mine)

    I acknowledge that it is always a dicey proposition to assume thread safety in contradiction to the docs. But I believe this is a documentation error. I have opened rdar://11161530 to track it. Please dupe.

    0 讨论(0)
提交回复
热议问题