(iphone)在重度ui更新之前显示活动指示器 [英] (iphone) showing activity indicator before heavy ui updating

查看:53
本文介绍了(iphone)在重度ui更新之前显示活动指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在进行大量的ui更新之前,我正在添加活动指示器视图(pushViewController需要一些时间来加载视图).

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

由于某些原因,直到按下新的viewController时才显示指示器视图.
(指示器视图在viewController推送动画发生之前显示,
尽管我的意图是在设备需要较长时间才能显示动画时显示指示器)

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)

除了将指标视图添加为子视图外,我还需要做其他事情吗?
我已经尝试过[indicatorView的Superview setNeedsDisplay];在pushViewController调用之前.

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

谢谢

推荐答案

如果长时间运行的操作在UI线程上,则会阻塞整个UI,包括微调器的显示/动画设置.如果您可以在后台线程上执行某些操作,那将更好.如果时间实际上是由视图布局本身占用的,那么您就有问题了,但是我的猜测是,大多数时间都由非UI活动占用.随意发布会给您带来麻烦的代码,因为如果没有代码,这个问题将很难诊断

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

这篇关于(iphone)在重度ui更新之前显示活动指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆