Take the 2-minute tour ×

Need to be able to draw on the screen from a thread other than main. Cannot use UIkit since it's not thread safe. Would Quartz 2D work in a thread? If so, how do I get to the screen to place the graphics? Clearly I'm a real newbie with graphics and any help would be appreciated.

share|improve this question
add comment

1 Answer

Yes Quartz would work in thread. However you cannot create a context in other thread. You have to pass the context from main thread. I believe create a CGContextRef in -drawRect method and pass it to thread. Take precaution that context dont go out of scope or just retain its reference.

How to get a screen to put graphics.. well as I said you need some place to create a context, may be some derived class of NSVIew. Then in -drawRect method make a context and pass it to thread.

CGContextRef contextref = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];


share|improve this answer
add comment

Your Answer


