首页 > 其他 > 详细

UITableViewCell的两种获取indexPath的方法

时间:2015-11-14 14:52:58      阅读:366      评论:0      收藏:0      [点我收藏+]

1. 通过叫Point获取

    CGPoint correctedPoint = [textField convertPoint:textField.bounds.origin toView:self.tableView];    

    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:correctedPoint];

    NSLog(@"Button tapped in row %ld", (long)indexPath.row);

2.通过superview获取

 UITableViewCell *cell = (UITableViewCell *)[[textField superview] superview];

    NSIndexPath *path = [self.mytableView indexPathForCell:cell];

   self.text_IndexPath = path.section;

UITableViewCell的两种获取indexPath的方法

原文:http://www.cnblogs.com/xiaoxiaolei/p/4964236.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!