分区头按钮点击事件获取当前cell

项目需求, 在tableView的分区头视图, 获取tableViewcell 记住 superview的使用

ShoppingCell *cell = (ShoppingCell *)[btn superview].superview.superview;
    
    NSIndexPath *p = [_tableView indexPathForCell:cell];

    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:p.row];
    
    [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];

你可能感兴趣的:(分区头按钮点击事件获取当前cell)