Lecture 13

Lecture 13 - Stanford CS193p Fall 2011 Developing...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Stanford CS193p Fall 2011 Developing Applications for iOS Fall 2011 Stanford CS193p Stanford CS193p Fall 2011 Today Core Data and Documents This is how you store something serious in iOS Easy entre into iCloud NSNoticationCenter The little radio station we talked about in the very rst lecture Objective-C Categories A way to add methods to a class without subclassing Stanford CS193p Fall 2011 Core Data Were object-oriented programmers and we dont like C APIs! We want to store our data using object-oriented programming! Enter Core Data Object-oriented database. Its a way of creating an object graph backed by a database Usually SQL. How does it work? Create a visual mapping (using Xcode tool) between database and objects. Create and query for objects using object-oriented API. Access the columns in the database table using @property s on those objects. Stanford CS193p Fall 2011 Creating a visual map of your applications database objects New File ... then Data Model under Core Data. Core Data This template This section Stanford CS193p Fall 2011 Creating a visual map of your applications database objects Unless we have multiple databases, usually we name the Data Model our application name Core Data Name of Data Model Stanford CS193p Fall 2011 The Data Model le. Sort of like a storyboard for databases. Stanford CS193p Fall 2011 The Data Model consists of ... Entities Attributes The Data Model consists of ... Entities The Data Model consists of ... The Data Model consists of ... Entities Attributes Relationships Were not going to talk about Fetched Properties Stanford CS193p Fall 2011 Click here to add an Entity. Then type the name here. Well call this rst Entity Photo. It will represent a Flickr photo. An Entity will appear in our code as an NSManagedObject (or subclass thereof). Stanford CS193p Fall 2011 Now we will add some Attributes. Well start with title. Click here to add an Attribute. Then edit the name of the Attribute here. Notice that we have an error. Thats because our Attribute needs a type. Stanford CS193p Fall 2011 Set the type of the title Attribute. All Attributes are objects . Numeric ones are NSNumber . Boolean is also NSNumber . Binary Data is NSData . Date is NSDate . String is NSString . Dont worry about Transformable. Attributes are accessed on our NSManagedObject s via the methods valueForKey: and setValueForKey: . Or, if we subclass NSManagedObject , we can access Attributes as @property s. Stanford CS193p Fall 2011 Here are a whole bunch more Attributes. You can see your Entities and Attributes in graphical form by clicking here. Stanford CS193p Fall 2011 This is the same thing we were just looking at, but in a graphical view. Stanford CS193p Fall 2011 Add another Entity....
View Full Document

This note was uploaded on 01/25/2012 for the course CS 193P taught by Professor Evandoll during the Fall '09 term at Stanford.

Page1 / 62

Lecture 13 - Stanford CS193p Fall 2011 Developing...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online