(iphone) showing activity indicator before heavy ui updating

夙愿已清 提交于 2019-12-11 02:39:37

问题


I'm adding activity indicator view before doing some heavy ui updating (pushViewController takes a while to load view).

For some reason, indicator view doesn't appear until the new viewController is pushed.
(indicator view shows up right before the viewController push animation takes place,
although my intention was to show the indicator while a device takes long time before the animation)

Should I do something more than adding the indicator view as a subview?
I already tried [indicatorView'sSuperview setNeedsDisplay]; before the pushViewController call.

Thank you


回答1:


If the long-running operation is on the UI thread, this will block the entire UI, including the showing/animating of a spinner. If you can do some of that on a background thread you'll be better off. If the time is really being taken up by the view layout itself then you have a problem, but my guess is that most of the time is being taken up by non-UI activity. Feel free to post the code that's giving you trouble, as the problem is a little hard to diagnose without the code



来源:https://stackoverflow.com/questions/5517160/iphone-showing-activity-indicator-before-heavy-ui-updating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!