UIView *v = [textView superview];//获取父类view
UIView *v1 = [v superview];
JWTYLIncomeInformationCell *cell = (JWTYLIncomeInformationCell *)[v1 superview];//获取cell
NSIndexPath *indexPathAll = [self.tableView indexPathForCell:cell];
NSLog(@"indexPath:--------%ld",(long)indexPathAll.row);
本文介绍了在Swift中使用UITableView时,如何通过cell获取其indexPath。具体实现方式为:首先获取cell的superview,然后进一步获取superview的superview直至找到UITableViewCell对应的cell,最后通过tableView的indexPathForCell方法获取indexPath。
2913

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



