Eureka: How to add action to detail disclosure button on Label Row

Created on 2 Sep 2016  路  2Comments  路  Source: xmartlabs/Eureka

Hi. I'd like to know if it's possible to add an action to a disclosure button. I'm using LabelRow.

I know that on cellUpdate I can do this:

.cellUpdate { cell, row in
       cell.accessoryType = .DetailDisclosureButton
}

But how do I retrieve that button and add a selector to it.

Thanks,
Allan

Most helpful comment

OK sorry for spamming but I got it:

             .cellUpdate { cell, row in
                let button = UIButton(type: .DetailDisclosure)
                button.addTarget(...)
                cell.accessoryView = button
             }

I hope this helps someone in the future.

All 2 comments

Found a solution but I don't know if this is correct: override the func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) on the class inheriting FormViewController.

OK sorry for spamming but I got it:

             .cellUpdate { cell, row in
                let button = UIButton(type: .DetailDisclosure)
                button.addTarget(...)
                cell.accessoryView = button
             }

I hope this helps someone in the future.

Was this page helpful?
0 / 5 - 0 ratings