iOS 分区tableview cell上的button 获取

2021-09-02  本文已影响0人  iOS门三闫

    [cell.btn addTarget:selfaction:@selector(didButtonClick:event:)forControlEvents:UIControlEventTouchUpInside];

- (void)didButtonClick:(UIButton *)senderevent:(id)event{

    NSSet*touches=[event allTouches];

    UITouch*touch=[touches anyObject];

    CGPoint cureentTouchPosition=[touch locationInView:self.tableView];

    //得到indexPath

    NSIndexPath *indexPath=[self.tableView indexPathForRowAtPoint:cureentTouchPosition];

}

上一篇 下一篇

猜你喜欢

热点阅读