UITableViewCell的两种获取indexPath的方法

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;

posted @ 2015-11-14 13:40  小小磊  阅读(1199)  评论(0)    收藏  举报