UIActivityIndicatorView 问题
这是一个有点愚蠢的问题,但我不知道如何解决它。
我正在制作一个 iPhone 应用程序,我只是想在加载 UITableView 时显示进度轮。我尝试测试视图是否正在加载,但出现错误: “对成员‘加载’的请求不是结构或联合”。所以,我不确定应该如何测试何时应该展示方向盘。也许我输错了什么?我不知道,但我对这个愚蠢的问题感到非常沮丧。因此,任何帮助将不胜感激。谢谢!
- (void) updateWheel {
//curtable is a uitableView
//wheel is a uiactivityIndicatorView
if (!curTbl.loading) { //THE ERROR IS FOR THIS LINE
[wheel stopAnimating];
} else {
[wheel startAnimating];
}
}
This is a bit of a silly question but I don't know how to get around it.
I am making an iphone app and I am just trying to display a progress wheel while my UITableView is loading. I try to test if the view is loading but I get an error:
'request for member 'loading' is something not a structure or a union'. So, I'm not sure how I am supposed to test for when I should show the wheel. maybe I have mistyped something? I don't know, but I am getting pretty frustrated with this silly problem. So, any help would be appreciated. Thanks!
- (void) updateWheel {
//curtable is a uitableView
//wheel is a uiactivityIndicatorView
if (!curTbl.loading) { //THE ERROR IS FOR THIS LINE
[wheel stopAnimating];
} else {
[wheel startAnimating];
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
UITableView 没有加载属性,这就是您在该行代码上收到编译错误的原因。正如 DarkDust 所说,您使用数据源协议将数据输入表视图的单元格中。当视图进入视图时,系统通过此委托请求单元格和数据,并且您在这些协议方法中提供单元格格式和数据。
There is no loading property of a UITableView, which would be why you are getting a compile error on that line of code. As DarkDust said, you use a data source protocol to feed data into the cells of a table view. As views come into view, the system requests the cell and data via this delegate, and you provide the cell formatting and data in these protocol methods.
我不确定“当我的 UITableView 正在加载时”是什么意思。您的意思是当它从数据源重新加载数据时?因为 UITableView 不涉及任何加载(并且没有成员“加载”。
如果您执行
[myTableView reloadData]
那么它正在查询其dataSource
。请参阅 UITableViewDataSource 的文档 因此,您负责加载数据,然后通知表视图数据源中的某些内容已更改,因此您应该知道何时仍在为数据源实现加载数据:-)
I'm not sure what you mean with "while my UITableView is loading". Do you mean while it is reloading data from the data source ? Because the UITableView is not involved any loading (and has no member "loading".
If you do
[myTableView reloadData]
then it is querying itsdataSource
. See the documentation of UITableViewDataSource protocol.So YOU are responsible for loading data and then informing the table view that something in the data source has changed, and thus you should know when you are still loading data for your data source implementation :-)