UITableView 未填充到选项卡栏 iPhone 应用程序中
我有一个选项卡栏应用程序,当选择其中一个按钮时,它会加载 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试从 -(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;