美文网首页
iOS 分区tableview cell上的button 获取

iOS 分区tableview cell上的button 获取

作者: iOS门三闫 | 来源:发表于2021-09-02 15:53 被阅读0次

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

}

相关文章

网友评论

      本文标题:iOS 分区tableview cell上的button 获取

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