[self.tableView indexPathForCell
我是要对cell 多个按钮做事情,然后遇到这个问题,
indexPathForCell
反馈 nil
解决方法
按钮对外事件
if ([button isKindOfClass:[UIButton class]]) {
UIView *view = button;
while (![view isKindOfClass:[UITableViewCell class]]) {
view = [view superview];
}
}
- (void)onActionOrderOk:(UIButton *)button
{ // 同意
if ([button isKindOfClass:[UIButton class]]) {
UIView *view = button;
while (![view isKindOfClass:[UITableViewCell class]]) {
view = [view superview];
}
//UIView *contentView = [button superview];
//MyOrderVCCell_2 *cell = (MyOrderVCCell_2 *)[contentView superview];
MyOrderVCCell_2 *cell = (MyOrderVCCell_2 *)view;
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
UIButton *okbtn = [cell viewWithTag:indexPath.row + 40012];
okbtn.hidden = YES;
UIButton *nobtn = [cell viewWithTag:indexPath.row + 50012];
nobtn.hidden = YES;
UIButton *okReceiptbtn = [cell viewWithTag:indexPath.row + 70012];
okReceiptbtn.hidden = NO;
XPFLog(@"%@----%@", indexPath, self.dataMutAry[indexPath.row]);
}
}