开发者

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

开发者 https://www.devze.com 2023-03-30 09:10 出处:网络
There\'s a very long method: - (IBA开发者_如何学Goction)buttonProcessDown { ... // indicator started

There's a very long method:

- (IBA开发者_如何学Goction)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!


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号