iOS 点击cell上的按钮获取行数

-(void)btnClick:(UIButton *)button{
    UITableViewCell *cell = (UITableViewCell *)[[button superview] superview];
    // 获取cell的indexPath
    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
    NSLog(@"点击的是第%ld行按钮",indexPath.row);
}

 

posted @ 2016-10-08 10:27  低头捡到蛋  阅读(2989)  评论(0编辑  收藏  举报