WaterBoy
WaterBoy

Reputation: 709

label not updating on iPhone

I am running a synchronise process on the main thread because I don't want the user to try and do anything else during the process. However I want to update the interface.

For the most part it does update, but sometimes the label I have has not quite caught up to the text I have set it.

Is there a way of forcing the UI to refresh.

I'm very scared I'm going to get clubbed about using a second thread....

Upvotes: 0

Views: 238

Answers (2)

Don't set text values on a background thread, have it call out to a method running on the main thread to update UI. None of the UI elements are thread safe.

Upvotes: 1

diederikh
diederikh

Reputation: 25271

Make sure you run the Runloop once in a while while processing:

[[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantPast]];

Upvotes: 1

Related Questions