ButtonTappedForRowWithIndexPath not working for custom button or label

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
      let key =  keyArray[indexPath.section-1]
      let label = UILabel(frame: CGRectMake(0, 0, 26, 28))
      label.center = CGPointMake(26, 28)
      cell.accessoryView = label
}

    override func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {
        print(indexPath)
    }

Why not to call for a custom label or custom button accessoryButtonTappedForRowWithIndexPath. Or just one way to add myButton to a cell?

+4
source share
1 answer

For a custom button, you can add a target for a specific event, accessoryButtonTappedForRowWithIndexPathwill not work for a custom view

Please contact:

enter image description here

+6
source

All Articles