在 Storyboard 中实现 TableView 的活动指示器

发布于 2024-12-24 00:47:22 字数 222 浏览 2 评论 0原文

我有一个实现文件,它从互联网上的 rss 加载数据,解析 xml 并填充我的 TableView 的行。我想在 TableView 上方显示一个活动指示器,直到填充整个表。

我的问题是,使用故事板时,我无法将活动指示器放在表格视图上方,而只能放在单个单元格上方。但在这种情况下,如果我编译,我会获得很多旋转器,每个单元一个。 关于如何在我的表格视图中仅显示一个旋转器有什么想法吗?

提前致谢, 亚萨

I have an implementation file that load data from rss in the internet, parse the xml and populates rows of my TableView. I would like to show an activity indicator above my TableView till the entire table is populated.

My problem is that with Storyboard I cannot put the activity indicator above the table view, but only above a single cell. But in this case, if I compile, I obtain a lot of spinners, one per cell.
Any ideas on how to show only one spinner centered in my table view?

Thanks in advance,
yassa

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

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

发布评论

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

评论(2

留一抹残留的笑 2024-12-31 00:47:22

好的,我找到了解决方案:使用故事板使用 ViewController (而不是 TableViewController)并放在 TableView 和活动指示器上方,如下所示:

在此处输入图像描述

我不知道这是否是最好的方法,但它对我有用!

Ok, I've found the solution: with storyboard use a ViewController (instead of a TableViewController) and put above a TableView and also an Activity Indicator, as follows:

enter image description here

I don't know if it's the best approach, but it worked for me!!!

墨洒年华 2024-12-31 00:47:22

看看 https://github.com/jdg/MBProgressHUD

MBProgressHUD 是一个 iPhone 嵌入式类,显示半透明
工作时带有进度指示器和一些可选标签的 HUD
在后台线程中完成。

使用该实现,您可能会获得开箱即用的所需效果。

Have a look at https://github.com/jdg/MBProgressHUD:

MBProgressHUD is an iPhone drop-in class that displays a translucent
HUD with a progress indicator and some optional labels while work is
being done in a background thread.

Using that implementation you might get your desired effect out-of-the-box.

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