美文网首页
被点击cell上的button获取indexpath

被点击cell上的button获取indexpath

作者: Kloar | 来源:发表于2017-02-15 08:46 被阅读26次

    [cell.changeBtn addTarget:self action:@selector(cellButtonClicked:event:) forControlEvents:UIControlEventTouchUpInside];

    - (void)cellButtonClicked:(id)sender event:(id)event {

    NSSet * touches =[event allTouches];

    UITouch * touch =[touches anyObject];

    CGPoint currentTouchPosition = [touch locationInView:_tableView];

    NSIndexPath * indexPath = [_tableView indexPathForRowAtPoint:currentTouchPosition];

    if (indexPath!= nil) {

    UploadCHstViewController *upVC =[UploadCHstViewController new];

    //传值

    [self.navigationController pushViewController:upVC animated:YES];

    }

    }

    相关文章

      网友评论

          本文标题:被点击cell上的button获取indexpath

          本文链接:https://www.haomeiwen.com/subject/ssofwttx.html