第一个关于UITableView的问题是这个接口
NSIndexPath *path = [self.tableV indexPathForCell:cell];
cell = (PersonalSHomeTableViewCell *)textField.superview.superview;
在ios8和ios9中使用正常,唯独在ios7中path为空,这是因为
cell上多了一层UITableViewWrapperView,所以需要调用
cell = (PersonalSHomeTableViewCell *)textField.superview.superview.superview;
这样path才可正常返回.
另外在代理:
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section中
必须返回
UITableViewHeaderFooterView或其子类时
下面这个接口方有效返回
[tableV headerViewForSection:]
中
本文探讨了UITableView在iOS7环境下indexPathForCell方法返回空值的问题,并提供了解决方案。通过调整对cell的获取方式,确保indexPath可以正确返回。此外,还提及了tableView:viewForHeaderInSection接口的有效使用条件。
976

被折叠的 条评论
为什么被折叠?



