关于UITableView 不能回调 tableView: cellForRowAtIndexPath的问题
2013-10-11 14:00
459 查看
做项目时始终遇到一个问题,tableview不能回调cellForRowAtIndexPath方法,导致cell不能显示。 在网上没找到合理的解决方案。 自己弄了一下,按照自己的推测解决了这个问题
首先确保
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
返回值不为零。然后确认自己的UITableView的frame设置是否正确,因为tableview显示或reload时,只有有可见的cell才会回调cellForRowAtIndexPath:,而且传回来的indexpath都是在可视范围的indexPath。 所以由于frame设置不对时,导致tableview计算的可视cell不对,故不回调。对于我自己,再viewDidAppear里正确设置frame后可正常调用和显示。
首先确保
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
返回值不为零。然后确认自己的UITableView的frame设置是否正确,因为tableview显示或reload时,只有有可见的cell才会回调cellForRowAtIndexPath:,而且传回来的indexpath都是在可视范围的indexPath。 所以由于frame设置不对时,导致tableview计算的可视cell不对,故不回调。对于我自己,再viewDidAppear里正确设置frame后可正常调用和显示。
相关文章推荐
- Ios 自定义表示图出现的相关问题UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath不执行的问题
- Ios 该图显示其出现的相关问题定义UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- 关于错误 reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
- UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath
- -tableView: cellForRowAtIndexPath:方法不执行问题
- UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
- 关于tableView:cellForRowAtIndexPath的解释
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;方法意思
- 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
- 当UITableView heightForRowAtIndexPath动态改变高度时 tableview向上滑动会jump 跳的问题
- 关于tableview不能全部显示cell的问题?
- UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath
- 使用storyboard显示UITableView时,如果不修改系统默认生成的tableView:cellForRowAtIndexPath:方法中的代码,则必须为UITableViewCell注册(填写)重用标识符:identifier.必须要代码方法中的标识符一致.
- 使用自定义的tableViewCell- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
- UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath
- UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath
- 如何解决关于TableView里面cell随机显示的问题
- tableView代理方法的调用时间,(主要是heightForRowAtIndexPath和cellForRowAtIndexPath调用时间)
- 【iOS】tableView:cellForRowAtIndexPath: 方法未调用