UIActivityIndi​​catorView 问题

发布于 2024-09-14 18:37:14 字数 450 浏览 2 评论 0原文

这是一个有点愚蠢的问题,但我不知道如何解决它。

我正在制作一个 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 技术交流群。

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

发布评论

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

评论(2

没企图 2024-09-21 18:37:14

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.

茶色山野 2024-09-21 18:37:14

我不确定“当我的 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 its dataSource. 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 :-)

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