被点击cell上的button获取indexpath

2017-02-15  本文已影响26人  Kloar

[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];

}

}

上一篇下一篇

猜你喜欢

热点阅读