Join Todd Perkins for an in-depth discussion in this video Sorting and deleting notes, part of Developing for the Apple iCloud API with iOS (2013).
The last thing we'll do for our application is sort all of the notes so that…the newest notes appear on the top.…In addition to that, we're going to make it so you can delete notes if you want…to when you click the Edit button.…So, first we will sort the notes. Go to makeObjects in MasterViewController, and…right under where we instantiate objects, call _objects sortUsingComparator.…I am going to press return so Xcode writes out the block of code.…
And in here I'm going to return in brackets [obj2 compare:obj1].…Now I want to typecast these two NSDates so that they are treated in that way.…So typecast both of these values to NSDate.…And those will be sorted again with the newest values first.…Now the reason why that typecast is going to work is because all of the keys are…actually strings of dates.…
So if you go to insertNewObject, remember we declared that key, it's a string…representation of the date.…So this is actually going to work when we typecast it back when we are…organizing them later.…
- Understanding the class structure of an app
- Building the data model and constants
- Making your app compatible with the Apple Developer portal
- Connecting to iCloud
- Understanding the UIDocument class
- Handling document metadata class
- Opening, closing, saving, and deleting documents from iCloud
Skill Level Intermediate
1. Building the Note-Taking App
2. Preparing the App to Use iCloud
3. Working with iCloud Key-Value Pairs
4. Working with iCloud Documents
Next steps2m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.