ios - UITableView reloadData 似乎不会导致 cellForRowAtIndexPath : to be called

标签 ios cocoa-touch uitableview

我目前正在使用 Storyboard编写一个应用程序,它在同一窗口中包含两个 UITableView

运行应用程序时,第一个 UITableView 将填充一些“注册号”。

当用户点击一个单元格时,第二个 UITableView 应该填充有关所选单元格的详细信息。

当点击第一个表中的数字时,我有一个方法可以驱动:

[mySecondTableView reloadData]

它是做什么的。我的印象是,在调用 reloadData 命令时,它应该同时调用:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

第一个会触发,但第二个不会。 我将数据源和委托(delegate)连接到自己。

我不确定我错过了什么。

这两种方法都应该触发吗?

最佳答案

当我遇到这样的事情时,通常是因为我在主线程之外调用了 -reloadData

关于ios - UITableView reloadData 似乎不会导致 cellForRowAtIndexPath : to be called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17894115/

相关文章:

swift - 滚动时 UITableViewCell 上的阴影消失

ios - 修复状态栏位置

ios - 如何在 iOS 中调用电话?

ios - 在 Swift 中访问 plist(错误 : "Expressions are not allowed at the top level")

objective-c - 当数据不是静态时,我应该如何保存大量数据。 iOS、 cocoa touch 、Obj-C

iphone - 为什么我的 UIView 子类在调用 setNeedsDisplay 后没有重绘?

ios - 没有为应用商店上的应用程序找到有效的 'aps-environment' 权利字符串

iphone - 布局具有大小约束的 UIView subview

ios - UITableView 上的 UIWebView 阻止 tablecell 选择

ios - 如何在我的单元格中更改附件类型 -> 披露指示器颜色?