MacBgnr Posted April 29, 2009 Share Posted April 29, 2009 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? Link to comment Share on other sites More sharing options...
stroke Posted April 30, 2009 Share Posted April 30, 2009 You can send an NSNotification to a controller object registered for that notification, or you can use NSObject's performSelectorOnMainThread:withObject:waitUntilDone: method. Link to comment Share on other sites More sharing options...
MacBgnr Posted April 30, 2009 Author Share Posted April 30, 2009 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? Link to comment Share on other sites More sharing options...
Recommended Posts