5
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 ?

mfaani
  • 33,269
  • 19
  • 164
  • 293
Arti
  • 7,356
  • 12
  • 57
  • 122

1 Answers1

8

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

Please refer:

enter image description here

pkamb
  • 33,281
  • 23
  • 160
  • 191
techloverr
  • 2,597
  • 1
  • 16
  • 28
  • can you please share a doc that mention not working with custom Button. because here said http://stackoverflow.com/questions/12296904/accessorybuttontappedforrowwithindexpath-not-getting-called – Nitin Gohel Mar 08 '16 at 12:24
  • that question is for native button – techloverr Mar 08 '16 at 12:28