Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

accessoryButtonTappedForRowWithIndexPath 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 for custom label or custom button not call accessoryButtonTappedForRowWithIndexPath . Or only one way add myButton to cell ?

like image 705
Arti Avatar asked Mar 08 '16 12:03

Arti


1 Answers

For custom button you can add target for specific event, accessoryButtonTappedForRowWithIndexPath will not work for custom view

Please refer:

enter image description here

like image 114
techloverr Avatar answered Nov 16 '22 00:11

techloverr