我目前正在使用 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/