Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:21:43+00:00 2026-06-01T09:21:43+00:00

So, as mentioned in this answer and in the iOS 4.0 release notes ,

  • 0

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 UIKit is now thread-safe. Specifically:

  • The routines used to access and manipulate the graphics context can now correctly handle contexts residing on different threads.
  • String and image drawing is now thread-safe.
  • Using color and font objects in multiple threads is now safe to do.

That’s great, but how do you use it?

As far as I’m aware, any time you’re not inside -drawRect: you can only draw using the UIKit/UIGraphics stuff if you’ve created your own context through UIGraphicsBeginImageContext() or UIGraphicsPushContext(), but those functions are not thread safe according to the docs, and -drawRect() is always called on the main thread.

I assume that creating an image context on the main thread and then starting the background method would be a really bad idea, due to race conditions aplenty.

So, how do I use this multithreaded UIKit-based drawing stuff that was introduced in iOS 4? What other ways of getting an active UIKit graphics context have I missed?

P.S. I know that I could just draw using Core Graphics and be done with it. For various reasons (legacy code) I’d like to continue using the UIKit based drawing methods.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:21:44+00:00Added an answer on June 1, 2026 at 9:21 am

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed this tutorial here as mentioned exactly I now try to run
Some people have mentioned RockScroll and MetaScroll in This Question , but those only
As mentioned in this answer simply calling the destructor for the second time is
In this stackoverflow answer a commenter mentioned that private nested classes can be quite
I'm using the automatic build versioning mentioned in this question (not the selected answer
This may be a basic question but the answer has alluded me so far.
I posted this question yesterday and the answer I go mentioned that I should
In this answer I've read about ppp.rb . It is mentioned as well-known, but
I just saw this mentioned in Stack Overflow question Best WYSIWYG CSS editor and
I have seen this mentioned a few times and I am not clear on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.