Detect tap on a button in UITableViewCell for UITableView containing multiple sections

前端 未结 4 1853
误落风尘
误落风尘 2020-12-04 16:00

I want to detect button tap on a UITableViewCell where the parent UITableView consists of multiple sections.

I was able to do it in the case of single section, but I

4条回答
  •  甜味超标
    2020-12-04 16:42

    Swift 5

     let touchPoint: CGPoint = sender.convert(.zero, to: tableViews)
        let clickedButtonIndexPath = self.tableViews.indexPathForRow(at: touchPoint)
                if(clickedButtonIndexPath != nil)
                {
                    NSLog("index path.section ==%ld", Int(clickedButtonIndexPath!.section))
                    NSLog("index path.row ==%ld", Int(clickedButtonIndexPath!.row))
                   }
    

提交回复
热议问题