Deleting rows in a table is not a complicated process if you have the right tools. This tutorial shows how to add an Edit/Done toggle button and how to delete table view rows.
- [Instructor] Our next step is to allow the app…to actually delete notes.…Now, there's actually an edit button…built into the navigation bar.…Let's look at how to apply that edit button.…At the bottom of viewDidLoad,…I'm going to type self.navigationItem.leftBarButtonItem…and I'm going to set that equal to editButtonItem.…Now this is not a button that we created.…This is an existing property of our ViewController.…
So, if I do that, and I run the application,…it actually places an edit button…in the left of the navigation bar.…And there is a great feature…that is built into this edit button.…So there's our edit button right there,…and watch what happens when I click on it.…It toggles between edit and done.…I don't have to do anything to add that functionality,…it's already built-in.…Now of course, it doesn't put the table in editing mode,…and I can't actually swipe left…to delete any of these rows right now,…but we're going to add that functionality.…
Stop the app, and return to Xcode.…Now, the edit button…actually calls a method in our ViewController automatically.…
In this course, join Todd Perkins as he takes you through how to create cross-platform apps using Swift. This course is one of three related courses designed to help you discover the similarities and differences that exist between the platforms used by three main devices: an Android phone, an iPhone, and a Windows phone. These courses use the same assets to create the same note-taking app so that you can identify and experience the complementary and contrasting development steps.
- Downloading Xcode
- Configuring preferences in Xcode
- Building the app interface
- Connecting interface elements to code
- Writing app logic
Skill Level Intermediate
1. Project Overview
A demo of the finished app1m 19s
2. Understanding iOS Specifics
3. Get Started
4. Create the Table and a Data Source
5. Edit and Save Data
6. Work with Multiple View Controllers
Next steps2m 1s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.