Help - Search - Members - Calendar
Full Version: update UI from worker thread
InsanelyMac Forum > Apple World > Mac Programming and Development
MacBgnr
Hello,

I am using NSThread to create a worker thread for a long task. However, from the main method of the worker thread, I want to Update some UI elements. How can I do this?
stroke
You can send an NSNotification to a controller object registered for that notification, or you can use NSObject's performSelectorOnMainThread:withObject:waitUntilDone: method.
MacBgnr
Thanks for the helpful reply.

I have implemented performSelectorOnMainThread:withObject:waitUntilDone. However, it looks like that it works when waitUntilDone is set to YES or when using sleep(1). The selector does not get called if I use waitUntilDone = NO and dont use sleep().

Any ideas how this can be resolved?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.