显示 UIView 的活动指示器,需要相当多的时间才能显示它自己
我有一个问题,我加载的模态视图需要相当长的时间才能显示。我没有进行任何服务调用。它只是尝试处理一些本地 XML 数据并加载视图。我想显示一个活动,直到我看到我的视图占据屏幕。有没有办法让我知道视图何时会出现? viewWillAppear 听起来不错,但如何使用它来通知模式演示者?
任何帮助都会很棒!
I have an issue where my Modal view that I load, takes quite a bit to show up.. I am making no service calls.. It is just trying to process some local XML data and load the view. I would like to show an activity till I see my view take up the screen. Is there a way I can know when the view is gonna appear. viewWillAppear sounds right, but how do I use it to Notify the modal presenter?
Any help would be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有有关您的实施的更多详细信息,则很难正确回答。
一般来说,您的视图控制器可以保留一个指向负责启动活动指示器的对象的指针,并在准备好时向其发送一条消息(如果一切都如此设置,则从 viewDidAppear )。或者,通知可以通过父控制器到达视图控制器。
我要做的是将 UIActivityIndicatorView 作为“慢”视图的子视图并在 xml 处理期间显示。所以一切都是通过同一个视图控制器来管理的;当数据准备好后,删除指标子视图,就完成了。
Without more detail about your implementation, it is not easy to answer properly.
Generally speaking, your view controller could keep a pointer to the object responsible for starting the activity indicator and send it a message when ready (from viewDidAppear, if everything is set so). Or, the notification could go through the parent controller to the view controller.
What I would do, is having a UIActivityIndicatorView as a subview of the "slow" view and displayed during the xml processing. So everything is managed through the same view controller; when the data is ready, you remove the indicator subview, and it's done.