Join Todd Perkins for an in-depth discussion in this video Creating a dictionary to manage data, part of Building a Note-Taking App for iOS 7.
…The easiest way to save data in iOS is through…a dictionary, which is a set of key and value pairs.…So let's set up our data model using a dictionary.…And then we'll look at saving that data to storage.…So under interface in Data.h, and I'm going to go down…a few lines, so I'm in line 17 in my code.…Now I'm going to create a few different class methods for managing data.…When you declare a class method in Objective-C, you took the plus sign and…return data type in parentheses, which in…this case is going to be first, NSMutableDictionary.…
Now mutable means changeable, so a mutable…dictionary can be changed after you create it.…If you take out the word mutable and just have an…NS dictionary, that object cannot be changed after you create it.…So we'll call this method, and this is going to be after the closed parenthesis.…Also note that there is an asterisk there, and an asterisk means that…the data type for a dictionary is a non primitive value, or a pointer.…So we'll call this method getAllNotes.…Just like that, and then a semi-colon to end that statement.…
These courses take you through building a complete mobile app from scratch; this installment uses the iOS SDK and Xcode to get the job done. Author Todd Perkins shows you how to create an Xcode project, lay out apps visually, connect UI elements to code, and save data to persistent storage. Start here, and compare and contrast your results with the other courses to learn about the differences and similarities of the platforms.
- Previewing the note-taking app's features
- Creating the Xcode project
- Using local data storage
- Creating a data class
- Saving data to a file
- Understanding screens and storyboards
- Creating and editing notes
- Controlling note display in a table view
- Deleting notes