xcode ios 如何在从 UITableView 中的 rss 提要获取数据期间显示活动指示器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6570009/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:24:45 来源:igfitidea点击:
ios how to show activity indicator during fetching the data from rss feed in UITableView?
提问by Bhagwan Dass Swami
I am trying to populating the data from a rss feed. This process take some time. During this delay I want to display a activity indicator and hide it when data is loaded. how can I do it? Please help
我正在尝试从 rss 提要填充数据。这个过程需要一些时间。在此延迟期间,我想显示一个活动指示器并在加载数据时隐藏它。我该怎么做?请帮忙
回答by taskinoor
- Add a
UIActivityIndicator
subview. - During the start of loading make it visible. You can disable all user interaction if you want and also can apply a semitransparent view to let users know that interaction is disabled.
- Start asynchronous loading of data. You must do asynchronous loading. In synchronous loading everything, including UI update, is blocked. So indicator won't animate in that case.
- When data loading is completed stop the connecting animation. And enable the interaction if disabled earlier.
- 添加
UIActivityIndicator
子视图。 - 在加载开始期间使其可见。如果需要,您可以禁用所有用户交互,也可以应用半透明视图让用户知道交互已禁用。
- 开始异步加载数据。您必须进行异步加载。在同步加载中,包括 UI 更新在内的所有内容都会被阻止。所以在这种情况下指标不会动画。
- 数据加载完成后停止连接动画。如果较早禁用,则启用交互。
And that's all.
就这样。