Forum Archive

TableView Swipe Row for More Buttons

JustBe

I already know how to create a TableView that allows swiping on a row to reveal the Delete button. So...

How would I make it so that two buttons are revealed after swiping on a row?

lukaskollmer

The built in ui.TableView supports only one action per row, but you can use the objc_util module to create a custom UITableView and implement the -[UITableViewDelegate tableView:editActionsForRowAtIndexPath: method which returns an array of table view row actions.

An other option for multiple actions per row would be to simply add an info accessory button to each row and show an alert w/ more options when the accessory button is pressed

JustBe

Ah, so I may have to learn a little Objective C then. I was hoping to avoid that, but it's good to know my options. Also, I like the accessory button technique you mentioned. Thank you, lukaskollmer.

JonB

I should also be possible to create a custom View class that goes into the content_view of your cell. you could implement swipe actions there, or for instance, a scrollview that shows some buttons.

i may have an example somewhere...

JustBe

If you have an example, that would be most welcome, JonB.