Stanford CS193p

Developing Applications for iOS Fall 2011

Stanford CS193p Fall 2011

Today
What is this class all about?
Description Prerequisites Homework / Final Project

iOS Overview
What’s in iOS?

MVC

Object-Oriented Design Concept

Objective C

New language! Basic concepts only for today.

Stanford CS193p Fall 2011

What will I learn in this course?
How to build cool apps
Easy to build even very complex applications Result lives in your pocket! Very easy to distribute your application through the AppStore Vibrant development community

Real-life Object-Oriented Programming

The heart of Cocoa Touch is 100% object-oriented Application of MVC design model Many computer science concepts applied in a commercial development platform: Databases, Graphics, Multimedia, Multithreading, Animation, Networking, and much, much more! Numerous students have gone on to sell products on the AppStore

Stanford CS193p Fall 2011

Stanford CS193p Fall 2011 . CS107 recommended You should know these terms! If you are not very comfortable with all of these. this might not be the class for you Programming Experience This is an upper-level CS course.Prerequisites Most Important Prereq! Object-Oriented Terms Class (description/template for an object) Instance (manifestation of a class) Message (sent to object to make it act) Method (code invoked by a Message) Instance Variable (object-specific storage) Superclass/Subclass (Inheritance) Protocol (non-class-specific methods) Object-Oriented Programming CS106A&B required. If you have never written a program where you had to design and implement more than a handful of classes. this will be a big step up in difficulty for you.

Assignments Weekly Homework 7 weekly assignments Assigned Thursday after lecture Due the following Wednesday at 11:59pm Individual work only Homework graded ✓.based on Required Tasks and Evaluation criteria Lots of extra credit available. bank it Only 3 “free” late days per quarter #1 fail: falling behind on homework Final Project 3 weeks to work on it But weighted like 4 weeks of homework Proposal requires instructor approval Some teams of 2 might be allowed Keynote presentation required (3 mins or so) Stanford CS193p Fall 2011 . ✓+ and ✓.

iOS Cocoa Touch Media Core Services Core OS Core OS OSX Kernel Power Management Mach 3.0 BSD Sockets Security Keychain Access Certificates File System Bonjour Stanford CS193p Fall 2011 .

iOS Cocoa Touch Media Core Services Core OS Core Services Collections Core Location Address Book Net Services Networking File Access SQLite Threading Preferences URL Utilities Stanford CS193p Fall 2011 .

PNG.iOS Cocoa Touch Media Core Services Core OS Media Core Audio OpenAL Audio Mixing JPEG. TIFF PDF Quartz (2D) Audio Recording Core Animation Video Playback OpenGL ES Stanford CS193p Fall 2011 .

iOS Cocoa Touch Media Core Services Core OS Cocoa Touch Multi-Touch Core Motion View Hierarchy Localization Controls Alerts Web View Map Kit Image Picker Camera Stanford CS193p Fall 2011 .

Frameworks Foundation Design Strategies re o C ta a D Ma p Kit Cor e Mot ion UIKit MVC Stanford CS193p Fall 2011 .Platform Components Tools Xcode 4 ent m u r t s In s Language [display setTextColor:[UIColor blackColor]].

MVC Controller Model View Divide objects in your program into 3 “camps.” Stanford CS193p Fall 2011 .

MVC Controller Model View Model = What your application is (but not how it is displayed) Stanford CS193p Fall 2011 .

MVC Controller Model View Controller = How your Model is presented to the user (UI logic) Stanford CS193p Fall 2011 .

MVC Controller Model View = Your Controller’s minions View Stanford CS193p Fall 2011 .

MVC Controller Model View It’s all about managing communication between camps Stanford CS193p Fall 2011 .

Stanford CS193p Fall 2011 .MVC Controller Model View Controllers can always talk directly to their Model.

Stanford CS193p Fall 2011 .MVC Controller outlet Model View Controllers can also talk directly to their View.

Stanford CS193p Fall 2011 .MVC Controller outlet Model View The Model and View should never speak to each other.

MVC Controller outlet ? View Model Can the View speak to its Controller? Stanford CS193p Fall 2011 .

Stanford CS193p Fall 2011 . Communication is “blind” and structured.MVC Controller outlet Model View Sort of.

Stanford CS193p Fall 2011 .MVC target Controller outlet Model View The Controller can drop a target on itself.

Stanford CS193p Fall 2011 .MVC target Controller outlet action Model View Then hand out an action to the View.

MVC target Controller outlet action Model View The View sends the action when things happen in the UI. Stanford CS193p Fall 2011 .

MVC target Controller outlet action should Model will View did Sometimes the View needs to synchronize with the Controller. Stanford CS193p Fall 2011 .

MVC should target did Controller will outlet g le de e at action Model View The Controller sets itself as the View’s delegate. Stanford CS193p Fall 2011 .

it’s “blind” to class).MVC should target did Controller will outlet g le de e at action Model View The delegate is set via a protocol (i. Stanford CS193p Fall 2011 .e.

Stanford CS193p Fall 2011 .MVC should target did Controller will outlet g le de e at action Model View Views do not own the data they display.

they have a protocol to acquire it.MVC should target did Controller will outlet g le de e at action Model data at count View So. if needed. Stanford CS193p Fall 2011 .

Stanford CS193p Fall 2011 .MVC should target did Controller data at count will outlet g le de e at da ta so u rc e action Model View Controllers are almost always that data source (not Model!).

MVC should target did Controller data at count will outlet g le de e at da ta so u rc e action Model View Controllers interpret/format Model information for the View. Stanford CS193p Fall 2011 .

MVC should target did Controller will ? Model data at count outlet g le de e at da ta so u rc e action View Can the Model talk directly to the Controller? Stanford CS193p Fall 2011 .

The Model is (should be) UI independent. Stanford CS193p Fall 2011 .MVC should target did Controller data at count will outlet g le de e at da ta so u rc e action Model View No.

MVC should target did Controller data at count will outlet g le de e at da ta so u rc e action Model View So what if the Model has information to update or something? Stanford CS193p Fall 2011 .

MVC should target did Controller data at count will outlet g le de Notification & KVO da ta so u e at rc e action Model View It uses a “radio station”-like broadcast mechanism. Stanford CS193p Fall 2011 .

Stanford CS193p Fall 2011 .MVC should target did Controller data at count will outlet g le de Notification & KVO da ta so u e at rc e action Model View Controllers (or other Model) “tune in” to interesting stuff.

MVC should target did Controller data at count will outlet g le de Notification & KVO da ta so u e at rc e action Model View A View might “tune in.” but probably not to a Model’s “station.” Stanford CS193p Fall 2011 .

Stanford CS193p Fall 2011 ..MVC should target did Controller data at count will outlet g le de Notification & KVO da ta so u e at rc e action Model View Now combine MVC groups to make complicated programs ..

MVCs working together Stanford CS193p Fall 2011 .

MVCs not working together Stanford CS193p Fall 2011 .

Objective-C New language to learn! Strict superset of C Adds syntax for classes. properties. “myValue”) The setter’s name is “set” plus capitalized property name (e. This is just your first glimpse of this language! We’ll go much more into the details next week. Don’t get too freaked out by the syntax at this point.) We just call the setter to store the value we want and the getter to get it.g.” A “property” is just the combination of a getter method and a setter method in a class. dynamic binding) Most important concept to understand today: Properties Usually we do not access instance variables directly in Objective-C.g. Stanford CS193p Fall 2011 . Instead. etc. Simple. we use “properties. The getter has the name of the property (e. “setMyValue:”) (To make this look nice.g. we always use a lowercase letter as the first letter of a property name. A few things to “think differently” about (e. methods.

m Importing our own header file. This is often <UIKit/UIKit. Spaceship.h" Class name Superclass @implementation Spaceship Note. #import "Spaceship.h" @interface Spaceship : Vehicle Objective-C Superclass’s header file. superclass not specified here. @end @end Stanford CS193p Fall 2011 .h> .h #import "Vehicle.Spaceship.

m // implementation of public and private methods @end @end Stanford CS193p Fall 2011 .h #import "Vehicle.h" @interface Spaceship : Vehicle // declaration of public methods Objective-C #import "Spaceship.h" @implementation Spaceship Spaceship.Spaceship.

h" @end @implementation Spaceship Spaceship.Spaceship. // implementation of public and private methods @end @end Stanford CS193p Fall 2011 .h" @interface Spaceship : Vehicle // declaration of public methods Objective-C #import "Spaceship. @interface Spaceship() // declaration of private methods (as needed) No superclass here either.m Don’t forget the ().h #import "Vehicle.

Spaceship. Spaceship. It does not return any value. Lining up the colons makes things look nice.h for method declaration below to work.h" @interface Spaceship() // declaration of private methods (as needed) @end @implementation Spaceship // implementation of public and private methods The full name of this method is orbitPlanet:atAltitude: . Note how each is preceded by its own keyword. It takes two arguments.h" #import "Planet.h" @interface Spaceship : Vehicle // declaration of public methods Objective-C We need to import Planet.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.h #import "Vehicle. @end @end Stanford CS193p Fall 2011 .m #import "Spaceship.

// implementation of public and private methods No semicolon here.h" @end @implementation Spaceship Spaceship.Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.h" @interface Spaceship : Vehicle // declaration of public methods Objective-C #import "Spaceship.h #import "Vehicle.m @interface Spaceship() // declaration of private methods (as needed) .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end Stanford CS193p Fall 2011 .h" #import "Planet. .

(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end Stanford CS193p Fall 2011 .(double)topSpeed.h #import "Vehicle.h" @interface Spaceship : Vehicle // declaration of public methods Objective-C #import "Spaceship. .m @interface Spaceship() // declaration of private methods (as needed) .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. // implementation of public and private methods .h" @end @implementation Spaceship Spaceship.h" #import "Planet.Spaceship.(void)setTopSpeed:(double)percentSpeedOfLight. .

(double)topSpeed { ??? } .m @interface Spaceship() // declaration of private methods (as needed) . // implementation of public and private methods . .h" @end @implementation Spaceship Spaceship.h" @interface Spaceship : Vehicle // declaration of public methods Objective-C #import "Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.(void)setTopSpeed:(double)percentSpeedOfLight.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end Stanford CS193p Fall 2011 .h #import "Vehicle. .(void)setTopSpeed:(double)speed { ??? } .Spaceship.(double)topSpeed.h" #import "Planet.

Spaceship.h
#import "Vehicle.h" #import "Planet.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed; - (void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km;

Objective-C
#import "Spaceship.h"

Spaceship.m

This @property essentially declares the two “topSpeed” methods below.

@interface Spaceship() // declaration of private methods (as needed) @end @implementation Spaceship // implementation of public and private methods

- (void)setTopSpeed:(double)percentSpeedOfLight; - (double)topSpeed;

- (void)setTopSpeed:(double)speed { ??? } - (double)topSpeed { ??? } - (void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here }

nonatomic means its setter and getter are not thread-safe. That’s no problem if this is UI code because all UI code happens on the main thread of the application.

@end

@end

Stanford CS193p Fall 2011

Spaceship.h
#import "Vehicle.h" #import "Planet.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed; - (void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km;

Objective-C
#import "Spaceship.h" @end @implementation Spaceship

Spaceship.m

@interface Spaceship() // declaration of private methods (as needed)

// implementation of public and private methods

We never declare both the @property and its setter and getter in the header file (just the @property).

- (void)setTopSpeed:(double)speed { ??? } - (double)topSpeed { ??? } - (void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here }

@end

@end

Stanford CS193p Fall 2011

Spaceship.h
#import "Vehicle.h" #import "Planet.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed; - (void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km;

Objective-C
#import "Spaceship.h" @end @implementation Spaceship

Spaceship.m

@interface Spaceship() // declaration of private methods (as needed)

This is the name of the storage location to use.

// implementation of public and private methods @synthesize topSpeed = _topSpeed; - (void)setTopSpeed:(double)speed { ??? _ (underbar) then the name of the property is a common naming convention. } - (double)topSpeed { ??? }
If we don’t use = here, @synthesize uses the name of the property (which is bad so always use =).

We almost always use @synthesize to create the implementation of the setter and getter for a @property. It both creates the setter and getter methods AND creates some storage to hold the value.

- (void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end

Stanford CS193p Fall 2011

} .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.(double)topSpeed { return _topSpeed.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed. @end @end Stanford CS193p Fall 2011 . Objective-C #import "Spaceship.(void)setTopSpeed:(double)speed { _topSpeed = speed.h" #import "Planet. .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } This is what the methods created by @synthesize would look like.h #import "Vehicle.m @interface Spaceship() // declaration of private methods (as needed) // implementation of public and private methods @synthesize topSpeed = _topSpeed.h" @end @implementation Spaceship Spaceship. . } .Spaceship.

h" @end @implementation Spaceship Spaceship.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed.h #import "Vehicle.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. Most of the time.h" #import "Planet.Spaceship. you can let @synthesize do all the work of creating setters and getters . Objective-C #import "Spaceship.m @interface Spaceship() // declaration of private methods (as needed) // implementation of public and private methods @synthesize topSpeed = _topSpeed.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end Stanford CS193p Fall 2011 . .

h" #import "Planet.m @interface Spaceship() // declaration of private methods (as needed) // implementation of public and private methods @synthesize topSpeed = _topSpeed.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end Stanford CS193p Fall 2011 .h #import "Vehicle.(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed. } However. .Spaceship. Objective-C #import "Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. .h" @end @implementation Spaceship Spaceship. we can create our own if there is any special work to do when setting or getting. .

(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed. This one is private (because it’s in our .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. strong) Wormhole *nearestWormhole.h" @implementation Spaceship Spaceship.m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic. } .Spaceship.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed.h" #import "Planet.h #import "Vehicle. Objective-C #import "Spaceship. Here’s another @property.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end Stanford CS193p Fall 2011 . . .m file). @end // implementation of public and private methods @synthesize topSpeed = _topSpeed.

Objective-C #import "Spaceship.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed. So we always access them through a pointer. } It’s a pointer to an object (of class Wormhole).h #import "Vehicle. . strong) Wormhole *nearestWormhole. Always.m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic.h" @implementation Spaceship Spaceship. All objects are always allocated on the heap. .h" #import "Planet. @end // implementation of public and private methods @synthesize topSpeed = _topSpeed. .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end @end Stanford CS193p Fall 2011 .Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed. It’s strong which means that the memory used by this object will stay around for as long as we need it.

(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed. This creates the setter and getter for our new does NOT create storage for the object this pointer points to. } We’ll talk about how to allocate and initialize the objects themselves next week.Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here } @end Stanford CS193p Fall 2011 . . @end . .h" #import "Planet.h" @implementation Spaceship Spaceship.m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic. strong) Wormhole *nearestWormhole.h #import "Vehicle. It just allocates room for the pointer.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. Objective-C #import "Spaceship. @synthesize @synthesize topSpeed = _topSpeed.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed. @synthesize nearestWormhole = _nearestWormhole. @end // implementation of public and private methods @property.

} . .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here Now let’s take a look at some example coding. This is just to get a feel for Objective-C syntax. @end // implementation of public and private methods @synthesize topSpeed = _topSpeed.m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic. .Spaceship.h #import "Vehicle.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed. Objective-C #import "Spaceship.h" @implementation Spaceship Spaceship. @synthesize nearestWormhole = _nearestWormhole.(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed. strong) Wormhole *nearestWormhole.h" #import "Planet. } @end @end Stanford CS193p Fall 2011 .

We’re calling topSpeed’ s getter on ourself here.h #import "Vehicle. @end @end Stanford CS193p Fall 2011 .m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here double speed = [self topSpeed]. @synthesize nearestWormhole = _nearestWormhole.h" #import "Planet.h" @implementation Spaceship Spaceship.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed. if (speed > MAX_RELATIVE) speed = MAX_RELATIVE.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.Spaceship. } . @end // implementation of public and private methods @synthesize topSpeed = _topSpeed. } The “square brackets” syntax is used to send messages.(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed. . strong) Wormhole *nearestWormhole. Objective-C #import "Spaceship. .

(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed.Spaceship.(void)setTopSpeed:(double)percentSpeedOfLight. strong) Wormhole *nearestWormhole. .h #import "Vehicle.m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed.h" #import "Planet. } . @end @end Stanford CS193p Fall 2011 . A reminder of what our getter declaration looks like. .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here double speed = [self topSpeed].(double)topSpeed. . Objective-C #import "Spaceship.h" @implementation Spaceship Spaceship. if (speed > MAX_RELATIVE) speed = MAX_RELATIVE. } . Recall that these two declarations are accomplished with the @property for topSpeed above. @synthesize nearestWormhole = _nearestWormhole. @end // implementation of public and private methods @synthesize topSpeed = _topSpeed.

h" @implementation Spaceship Spaceship.m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here double speed = [self topSpeed]. . .h" #import "Planet. } .(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed. @end Square brackets inside square brackets. } Here’s another example of sending a message. @end Stanford CS193p Fall 2011 .(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. @synthesize nearestWormhole = _nearestWormhole. Objective-C #import "Spaceship. @end // implementation of public and private methods @synthesize topSpeed = _topSpeed.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed.Spaceship. [[self nearestWormhole] travelToPlanet:aPlanet atSpeed:speed]. It is being sent to an instance of Wormhole. if (speed > MAX_RELATIVE) speed = MAX_RELATIVE. strong) Wormhole *nearestWormhole. It looks like this method has 2 arguments: a Planet to travel to and a speed to travel at.h #import "Vehicle.

topSpeed. @synthesize nearestWormhole = _nearestWormhole. if (speed > MAX_RELATIVE) speed = MAX_RELATIVE. @end // implementation of public and private methods @synthesize topSpeed = _topSpeed. Objective-C #import "Spaceship.Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. [[self nearestWormhole] travelToPlanet:aPlanet atSpeed:speed]. strong) Wormhole *nearestWormhole.h" @implementation Spaceship Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here double speed = self. .h" #import "Planet.h #import "Vehicle. . { if ((speed < 1) && (speed > 0)) _topSpeed = speed.(void)setTopSpeed:(double)speed This is identical to [self topSpeed]. } @end Calling getters and setters is such an important task. } .m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed. @end Stanford CS193p Fall 2011 . it has its own syntax: dot notation.

@synthesize nearestWormhole = _nearestWormhole.nearestWormhole travelToPlanet:aPlanet atSpeed:speed]. strong) Wormhole *nearestWormhole. if (speed > MAX_RELATIVE) speed = MAX_RELATIVE. @end @end Stanford CS193p Fall 2011 .h" #import "Planet.h" @implementation Spaceship Spaceship.topSpeed.h #import "Vehicle.h" @interface Spaceship : Vehicle // declaration of public methods @property (nonatomic) double topSpeed.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km { // put the code to orbit a planet here double speed = self.m @interface Spaceship() // declaration of private methods (as needed) @property (nonatomic. .Spaceship.(void)orbitPlanet:(Planet *)aPlanet atAltitude:(double)km. @end // implementation of public and private methods @synthesize topSpeed = _topSpeed. } We can use dot notation here too. } . . [self.(void)setTopSpeed:(double)speed { if ((speed < 1) && (speed > 0)) _topSpeed = speed. Objective-C #import "Spaceship.

Coming Up Next Lecture Overview of the Integrated Development Environment (IDE. etc. i. Optional. Next Week Objective-C language in depth Foundation classes: arrays. categories and much. Xcode 4) Objective-C in action Concrete example of MVC Major demonstration of all of the above: RPN Calculator (HOMEWORK: if you do not know what an RPN Calculator is.) Friday Very simple introduction to using the debugger. look it up on the internet.e. much more! Stanford CS193p Fall 2011 . strings. dictionaries. static typing Protocols. You can figure it out on your own if you want (not too difficult). Dynamic vs.

Sign up to vote on this title
UsefulNot useful