UITableView - 在加载数据时隐藏所有组/单元格 [英] UITableView - hide all groups/cells while data is loading

查看:113
本文介绍了UITableView - 在加载数据时隐藏所有组/单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在从外部源加载数据之前,我不想显示表视图单元格。我想在加载数据时在表格背景上显示活动指示符。我可以通过将它作为子视图添加到tableView来显示指示器,但我无法弄清楚如何隐藏行直到它们准备好显示。

I don't want to display my table view cells until the data has been loaded from an external source. I want to show an activity indicator over the table background while the data is loading. I can get the indicator to show by adding it as a subview to tableView, but I can't figure out how to hide the rows until they are ready to be displayed.

这都是在UITableViewController中处理的。该表以弹出窗口显示。

This is all being handled in a UITableViewController. The table is displayed in a popover.

推荐答案

您可能有不同的解决方案。

也许第一个并且速度越快,对uiTableView数据源说没有任何部分。然后当你的外部数据加载时,重新加载tableView的部分和行。

You may have differents solutions.
Maybe the first one and the faster, saying to the uiTableView datasource there is no section. Then when your externals datas are loaded, reload the tableView with the sections and rows.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

其他解决方案,隐藏uiTableView并在其他视图上设置活动指示器。但你需要避免UITableViewController来实现这个目标^^

Other solution, hide the uiTableView and set your activity indicator on an other view. But you need to avoid UITableViewController to achieve this ^^

也许第一个解决方案会更快; - )

Maybe the first solution would be the faster ;-)

这篇关于UITableView - 在加载数据时隐藏所有组/单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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