Lecture 3

Lecture 3 - Stanford CS193p Developing Applications for iOS...

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

View Full Document Right Arrow Icon
Stanford CS193p Fall 2011 Stanford CS193p Developing Applications for iOS Fall 2011
Background image of page 1

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

View Full DocumentRight Arrow Icon
Stanford CS193p Fall 2011 Lessons from Walkthrough Xcode 4 - You’ve learned how to . .. Create a new project with a single MVC Show various ±les in your project (via Navigator or clicking on bars at the top of ±les) Show and hide the Navigator, Assistant Editor, Console, Object Library, Inspector Drag objects into your view and edit their size, position and object-speci±c display attributes Ctrl-drag to connect objects in your View to the code in your Controller (outlets and actions) Show connections to outlet @property s and action methods (by mouse-over or right click) Get quick help (option click) or full documentation (option double-click) for symbols in your code Run your application in the simulator Click on warning (yellow) and error (red) indicators to see problems in your code Create a new class (like CalculatorBrain ) using the File menu’s New File . .. item Create browser-like tabs to organize your viewing of your project
Background image of page 2
Stanford CS193p Fall 2011 Lessons from Walkthrough Objective C - You’ve learned how to . .. De±ne a class’s public @interface and private @implementation in a .h and .m ±le respectively Add a private @interface to .m ±le Create a @property , both for a primitive type (like BOOL ) and a pointer (like NSMutableArray * ) Use nonatomic in @property declarations Use strong or weak in @property declarations of pointers to objects Use @synthesize to create a @property ’s setter and getter and backing instance variable Use “ = _propertyname ”to choose the name @synthesize uses for its backing instance variable For pointers to an object, use either the special type id or a static type (e.g. UIButton * ) Declare and de±ne an Objective C method (e.g. pushOperand: or popOperand ). Declare local variables both of type “pointer to an object” ( id or static type) and primitive type Invoke an Objective C method (using square bracket [] notation) Invoke a setter or getter using dot notation (e.g. self.operandStack or self.display.text ) Lazily instantiate an object by implementing your own @property getter ( operandStack & brain )
Background image of page 3

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

View Full DocumentRight Arrow Icon
Stanford CS193p Fall 2011 Lessons from Walkthrough Objective C (continued) - You’ve learned how to . .. Wrap a primitive type (like double ) in an object (using NSNumber ) Log formatted strings to the console using NSLog() Use a “constant” NSString in your code using @“” syntax (e.g. @“+” ) Add and remove an object from an NSMutableArray (the last object anyway ± ). Use alloc and init to create space in the heap for an object (well, you’ve barely learned this). #import the .h ±le of one class into another’s ( CalculatorBrain.h into your Controller) Create a string by asking a string to append another string onto it Create a string with a printf-like format (e.g., [ NSString stringWithFormat: @“%g” , result] ) Perhaps you’ve learned even more if you’ve done Assignment #1!
Background image of page 4
Stanford CS193p Fall 2011 More on Properties Why properties?
Background image of page 5

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

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

Page1 / 48

Lecture 3 - Stanford CS193p Developing Applications for iOS...

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

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