【iOS】tableView:cellForRowAtIndexPath: 方法未调用

今天遇到这个问题, UITableView 的代理方法 tableView:cellForRowAtIndexPath: 

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

没调用。

有人说可能 delegate 或 dataSource 没有配置,检查了下,都配置了,如下:

self.tableView.delegate=self;
self.tableView.dataSource=self;

后来终于找到了原因,原来是 reloadData 方法没调用!

[self.tableView reloadData];

网络请求之后调用下该方法就可以了。

原文地址:https://www.cnblogs.com/jaxer/p/5032911.html