UITableView 未填充到选项卡栏 iPhone 应用程序中

发布于 2024-09-28 22:36:55 字数 229 浏览 0 评论 0原文

我有一个选项卡栏应用程序,当选择其中一个按钮时,它会加载 UITableView。它似乎加载了视图控制器,但似乎没有填充数据。我尝试设置 cell.text = @"cell" (同时设置行数 > 0)并且 CellForRowAtIndexPath 中的 NSLog 证明实际上该函数没有被调用。 viewDidLoad 函数中控制台的相同 NSLog 输出也不会生成任何输出,因此看起来好像没有被调用。

有什么建议吗?

I have a tab bar application which loads a UITableView when one of it's buttons are selected. It seems to load the view controller however it doesn't seem to be populating the data. I have tried setting the cell.text = @"cell" (while setting the number of rows > 0) and an NSLog in the CellForRowAtIndexPath proves that in fact the function is not being called. The same NSLog output to the console in the viewDidLoad function also generates no output so it seems as though its not getting called.

Any suggestions?

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

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

发布评论

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

评论(1

北座城市 2024-10-05 22:36:55

尝试从 -(void)viewWillAppear:(BOOL)animated; 调用 [tableView reloadData]方法。每次用户导航到该选项卡时都应调用此函数,并应引发当前未调用的委托回调。如果仍然没有被调用,请确保您已将表委托设置为 self。

编辑:实际上确保您已将表视图的委托和数据源设置为 self;

Try and call [tableView reloadData] from your -(void)viewWillAppear:(BOOL)animated; method. This should be called each time the user navigates to that tab and should set off the delegate callbacks that aren't currently being called. If they still aren't called make sure you have set the table delegate to self.

EDIT: Actually make sure you have set your table view's delegate and datasource to self;

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