ios 如何在 UITableView 中从 rss feed 获取数据时显示活动指示器?

发布于 2024-11-18 08:59:20 字数 75 浏览 4 评论 0原文

我正在尝试从 rss feed 填充数据。这个过程需要一些时间。在此延迟期间,我想显示活动指示器并在加载数据时隐藏它。我该怎么办?请帮忙

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵性 2024-11-25 08:59:20
  1. 添加 UIActivityIndi​​cator 子视图。
  2. 在加载开始期间使其可见。如果需要,您可以禁用所有用户交互,也可以应用半透明视图让用户知道交互已禁用。
  3. 开始异步加载数据。您必须进行异步加载。在同步加载中,所有内容(包括 UI 更新)都会被阻止。因此在这种情况下指示器不会动画。
  4. 数据加载完成后停止连接动画。如果之前禁用了交互,则启用交互。

仅此而已。

  1. Add a UIActivityIndicator subview.
  2. 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.
  3. 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.
  4. When data loading is completed stop the connecting animation. And enable the interaction if disabled earlier.

And that's all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文