Video: Deleting feedsNow that we can add feeds, we should be able to delete feeds, too. Cocoa Touch has a neat UI for this. You can press an Edit button which will reveal special red delete icons, or you can swipe to delete. This interface is easy to implement, and because it's so common, it will be familiar to the user. So, we'll start by making a working copy of BWRSS-addView-05, and we'll rename it as 06. So, I'm going to use the done version here. And you can use the done version or you can use the version that you created in the last movie if you've been following along.
Viewers: in countries Watching now:
The iOS software development kit (SDK) includes the popular SQLite library, a lightweight yet powerful relational database engine that is easily embedded into an application. In this course, Bill Weinman teaches you how to build an RSS reader for iOS devices, integrating XML data and a streamlined interface. He explains how to use the SQLite database, display information in a table view, code view controllers, and create a preferences pane for your app. The resulting application is optimized for all iPhone and iPad displays.
- Prototyping the app
- Coding and working with a testbed
- Creating an Objective-C interface for SQLite
- Designing a database schema
- Creating the view controllers
- Reading and writing to the database
- Parsing the RSS feed with NSXMLParser
- Updating the item view with feed items
- Implementing the pull to refresh gesture for iOS 6
- Creating a universal application with multiple views
Now that we can add feeds, we should be able to delete feeds, too. Cocoa Touch has a neat UI for this. You can press an Edit button which will reveal special red delete icons, or you can swipe to delete. This interface is easy to implement, and because it's so common, it will be familiar to the user. So, we'll start by making a working copy of BWRSS-addView-05, and we'll rename it as 06. So, I'm going to use the done version here. And you can use the done version or you can use the version that you created in the last movie if you've been following along.
And I'm going to open this in Xcode by double-clicking on the Xcode project file. And we're going to come back out here to the Finder and I'm going to open this 06-methods.txt file. And it just has this one method in it, and I'm going to copy that and come over in to Xcode and we'll paste it in. We're going to put this right at the end of the tableView section. We'll go ahead and delete all of this, and we'll just paste it in right there.
This method is called tableView commitEditingStyle forRowAtIndexPath, and it passes this editingStyle, and if the editingStyle is the ViewCellEditingStyleDelete, then we go ahead and implement the delete. So, this is really very simple, and if we go ahead and run this in the iPhone Simulator, we see we have the CNN.com Top Stories that we added in the last movie. I'm just going to press this Edit button and you'll notice there I get these little red Delete icons. If I select the one next to CNN.com Top Stories, I get a Delete button, and I can press that, and it deletes it, and I can press Done, and it's gone. And that's all what we've just implemented here.
It actually deleted it from the database and it loaded the FeedIDs again and displayed them again, and it calls this deleteRowsAtIndexPath with RowAnimation to animate the delete, and we're using this fade method. We can change this, and there's a number of different methods available. We could use one called Left. I need to stop it and run it again. And I'll go ahead and I'll add CNN again, and then we delete it. We will go ahead and this time we'll do the swipe gesture for delete, and when we do the swipe gesture, we get the same little Delete button, and you'll notice this time it's swiped off to the left for the delete.
So, we have left, we have right, we have top, we have middle, and we have automatic, as well as the fade that we started with. The middle one is a little bit interesting. It might not show up well on the screen, but if you try this on your computer-- I'm going to go ahead and run this again, and we'll add that same feed again, and we'll go ahead and delete it-- you see that it folds over when I press this, and it deletes it that way. So, I'm just going to return this to the fade version, and we'll save that I'm going to press Command+.
to stop it running on the simulator. So, that's really all there is to it. Cocoa Touch makes this really easy to implement and all the heavy lifting is done for you. All you need to do is implement the proper delegate method, and it works just fine.
Find answers to the most frequently asked questions about iOS SDK and SQLite: Building Data-Driven Apps (2013) .
Here are the FAQs that matched your search "" :
- Q: Why is the RSSDB library in the exercise files different than the one in the videos?
A: The RSSDB library had to be updated to work around a bug in the iOS 7 SDK.
There is a bug in the iOS 7 SDK that prevents the BWDB fast enumeration implementation from working on a device. The symptom is code that runs fine on the emulator, but not on a device. iOS devices use an ARM processor, while the emulator runs on your Mac's Intel processor. This points to the LLVM ARM code generator as the source of the bug. Because the bug appears to be in the LLVM compiler, it may be some time before it is fixed.
As a workaround we have changed the getFeedIDs and getItemIDs methods in the RSSDB library so they don't use Objective C fast enumeration.
Please note that this same bug also affects some of the BWDB testbed code in Chapter 2. The result is that it will run on the emulator but not on a device.
- Q: After upgrading to Xcode 5.1 I get an error that says:
"Used type va_list (aka_builtin_va_list) where arithmetic or pointer type is required"
- A: Please download the exercise files again to get the latest version of the BWDB library.
- Q: I'm using Xcode 6. Why am I getting error messages with the exercise files?
- A: A lot has changed in iOS since this course was released. The author is in the process of rewriting the code and updating the course for iOS 8. In the meantime he has prepared a version of the app that works in iOS 8 and Xcode 6. Download it here:http://ios.bw.org/
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.