O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

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

Deleting Records

If you’ve been running the app to test it along the way, you probably have a long list of contacts that cannot be deleted. This is not an ideal situation, so now it’s time to add the capability to delete records from both the table and the database.

The pattern here is slightly different from what you did to be able to add records. You still need to create a button for the navigation bar that will put the table in edit mode. In edit mode, the user can tap a row to delete it from both the table and data source. This requires implementing a UITableViewDataSource delegate method that is called when the user selects a row for deletion.

Start by adding this line to the end of viewDidLoad: in LMAContactsTableController.m:

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