Lecture 05_0

Lecture 05_0 - CS193p Spring 2010 Monday, April 12, 2010...

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

View Full Document Right Arrow Icon
CS193p Spring 2010 Monday, April 12, 2010
Background image of page 1

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

View Full DocumentRight Arrow Icon
Announcements Axess! Make sure your grading option matches what you were approved for Sonali’s OfFce Hours Changed ±riday 11am to 1pm Thursday 10am to noon Gates B26B Any questions about the Homework? Did everyone get the e-mail about entering numbers? Monday, April 12, 2010
Background image of page 2
Communication E-mail Questions are best sent to cs193p@cs.stanford.edu Sending directly to instructor or TA’s risks slow response. Web Site Very Important! http://cs193p.stanford.edu All lectures, assignments, code, etc. will be there. This site will be your best friend when it comes to getting info. Monday, April 12, 2010
Background image of page 3

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

View Full DocumentRight Arrow Icon
To day ’s To pics Protocols and Delegates Views Core Graphics Demo Monday, April 12, 2010
Background image of page 4
Protocols Very similar to @interface , but no implementation @protocol Foo - (void)doSomething; @optional - (int)getSomething; @required - (NSArray *)getManySomethings:(int)howMany; @end Classes then proclaim they implement a protocol @interface MyClass : NSObject <Foo> ... @end Monday, April 12, 2010
Background image of page 5

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

View Full DocumentRight Arrow Icon
Protocols Declaring arguments to require a protocol - (void)giveMeTheObject:(id <Foo>)anObjectImplementingFoo Declaring variables to require a protocol id <Foo> obj = [[MyClass alloc] init]; [obj doSomething]; // will not warn (and should be okay) Compiler will warn of misbehavior Class says it implements protocol Foo , but doesn’t implement required methods Assigning an object which does not implement Foo to a variable like obj above Passing an object which does not implement Foo through an argument which requires it (like above) Monday, April 12, 2010
Background image of page 6
Delegates Used to “delegate” responsibility to other objects Protocol defnes what the responsibility is Great way to maintain MVC but with Fexibility O±tentimes View objects do this Will see example o± this in demo Very common paradigm in UIKit Monday, April 12, 2010
Background image of page 7

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

View Full DocumentRight Arrow Icon
Views Rectangular area on screen Draws and handles events in that rectangle Hierarchical Only one superview: - (UIView *)superview Can have many (or zero) subviews: - (NSArray *)subviews Subview order matters: those later in the array are on top of earlier UIWindow The UIView at the top of the view hierarchy Only have one UIWindow in an iPhone application (it’s all about views) Monday, April 12, 2010
Background image of page 8
View Hierarchy Hierarchy often constructed in IB Even custom views can be added to the hierarchy in IB How to do it in code though? - (void)addSubview:(UIView *)aView;
Background image of page 9

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

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

Page1 / 29

Lecture 05_0 - CS193p Spring 2010 Monday, April 12, 2010...

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

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