在UIButton的点击事件中做处理,以下是两种方法:
方法1:
UITableViewCell * cell = [(UITableViewCell*)[sender superview] superview];
NSIndexPath * indexPath = [self.table indexPathForCell:cell];
DLog(@"cell's row %d",indexPath.row);
方法2:
UIButton * btn = (UIButton*)sender;
CGRect buttonRect = btn.frame;
for (UITableViewCell *cell in [self.table visibleCells]) {
if (CGRectIntersectsRect(buttonRect, cell.frame)) {
//TODO
}
}