O'Reilly logo

RubyMotion by Clay Allsopp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Swiping-to-Delete Table Rows

Swipe-to-delete is a signature iOS interaction. Notably available in Mailapp, deleting and editing data in UITableViews is a built-in API and an easy way to add some polish to your app.

To allow the user to delete table rows, you need to implement yet more dataSource methods.

  • tableView:editingStyleForRowAtIndexPath:, where we determine how each row can be edited. If a row can be edited, then the table view will change the UI accordingly. After the user has acted upon that UI, like tapping the Delete button, we call commitEditingStyle:forRowAtIndexPath:.

  • tableView:commitEditingStyle:forRowAtIndexPath:, which is called after the user has edited or deleted some table view element. At this point, we need to actually ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required