Dmitry
Dmitry

Reputation: 14622

How to redraw the actual screen of iPhone in the middle of any method?

There's a very long method:

- (IBAction)buttonProcessDown
{
    ... // indicator started
    ... // active tab changed
    ... // any text changed
    ... // indicator stopped
}

How to redraw the current state of all controls on iPhone screen inside this method (4 times for all changes)?

Thanks a lot for help!

Upvotes: 0

Views: 86

Answers (2)

Magic Bullet Dave
Magic Bullet Dave

Reputation: 9076

I would break the main method into 4 separate methods and use performSelector:afterDelay: for the first method and make the same call again at the end of the second, etc. This way your code will get chance for the UI to redraw itself.

The best solution, though, is to not block the main thread at all (the UI) and to push processing if at all possible onto another thread using performSelectorInBackground.

Upvotes: 1

Daniel Dickison
Daniel Dickison

Reputation: 21882

You do not. You have to return control back to the event loop to do drawing. What you need to do is schedule methods to fire in the future to change the UI.

Upvotes: 1

Related Questions