cs193p - lecture 11 · iphone application development text input presenting content modally...

90
CS193P - Lecture 11 iPhone Application Development Text Input Presenting Content Modally 1 Wednesday, February 10, 2010

Upload: others

Post on 11-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

CS193P - Lecture 11iPhone Application Development

Text InputPresenting Content Modally

1Wednesday, February 10, 2010

Page 2: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Announcements

2Wednesday, February 10, 2010

Page 3: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Announcements• Paparazzi 3 assignment is due Wednesday 2/17

2Wednesday, February 10, 2010

Page 4: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Announcements• Paparazzi 3 assignment is due Wednesday 2/17• This Friday’s extra session will feature Evan Doll

2Wednesday, February 10, 2010

Page 5: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Today’s Topics• Threading Wrap-Up• iPhone Keyboards• Customizing Text Input• Presenting Content Modally

3Wednesday, February 10, 2010

Page 6: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Alternatives to Threading

4Wednesday, February 10, 2010

Page 7: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Alternatives to Threading• Asynchronous (nonblocking) functions

■ Specify target/action or delegate for callback■ NSURLConnection has synchronous and asynchronous variants

4Wednesday, February 10, 2010

Page 8: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Alternatives to Threading• Asynchronous (nonblocking) functions

■ Specify target/action or delegate for callback■ NSURLConnection has synchronous and asynchronous variants

• Timers■ One-shot or recurring■ Specify a callback method■ Managed by the run loop

4Wednesday, February 10, 2010

Page 9: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Alternatives to Threading• Asynchronous (nonblocking) functions

■ Specify target/action or delegate for callback■ NSURLConnection has synchronous and asynchronous variants

• Timers■ One-shot or recurring■ Specify a callback method■ Managed by the run loop

• Higher level constructs like operations

4Wednesday, February 10, 2010

Page 10: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

NSOperation• Abstract superclass• Manages thread creation and lifecycle

• Encapsulate a unit of work in an object• Specify priorities and dependencies

5Wednesday, February 10, 2010

Page 11: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Creating an NSOperation Subclass

6Wednesday, February 10, 2010

Page 12: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Creating an NSOperation Subclass• Define a custom init method

- (id)initWithSomeObject:(id)someObject{

self = [super init];if (self) {

self.someObject = someObject;}return self;

}

6Wednesday, February 10, 2010

Page 13: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Creating an NSOperation Subclass• Define a custom init method

• Override -main method to do work

- (id)initWithSomeObject:(id)someObject{

self = [super init];if (self) {

self.someObject = someObject;}return self;

}

- (void)main{

[someObject doLotsOfTimeConsumingWork];}

6Wednesday, February 10, 2010

Page 14: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

NSOperationQueue• Operations are typically scheduled by adding to a queue• Choose a maximum number of concurrent operations• Queue runs operations based on priority and dependencies

7Wednesday, February 10, 2010

Page 15: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Using an NSInvocationOperation• Concrete subclass of NSOperation• For lightweight tasks where creating a subclass is overkill

8Wednesday, February 10, 2010

Page 16: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Using an NSInvocationOperation• Concrete subclass of NSOperation• For lightweight tasks where creating a subclass is overkill

- (void)someAction:(id)sender{

NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(doWork:) object:someObject];

[queue addObject:operation];

[operation release];}

8Wednesday, February 10, 2010

Page 17: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

iPhone Keyboards

9Wednesday, February 10, 2010

Page 18: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Virtual keyboard Appears when needed

10Wednesday, February 10, 2010

Page 19: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Virtual keyboard Appears when needed

11Wednesday, February 10, 2010

Page 20: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

12Wednesday, February 10, 2010

Page 21: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

13Wednesday, February 10, 2010

Page 22: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Portrait and Landscape

13Wednesday, February 10, 2010

Page 23: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Simple selection modelText loupe/magnifier

14Wednesday, February 10, 2010

Page 24: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Many keyboard typesAdapted to task

15Wednesday, February 10, 2010

Page 25: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Many keyboard typesAdapted to task

16Wednesday, February 10, 2010

Page 26: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Many keyboard typesAdapted to task

17Wednesday, February 10, 2010

Page 27: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Many keyboard typesAdapted to task

18Wednesday, February 10, 2010

Page 28: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Many keyboard typesAdapted to task

19Wednesday, February 10, 2010

Page 29: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Many keyboard typesAdapted to task

20Wednesday, February 10, 2010

Page 30: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Single line editing

21Wednesday, February 10, 2010

Page 31: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Multi-line editing

22Wednesday, February 10, 2010

Page 32: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

40Languages

23Wednesday, February 10, 2010

Page 33: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

40Languages

Full dictionary support

23Wednesday, February 10, 2010

Page 34: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

English

24Wednesday, February 10, 2010

Page 35: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

French

25Wednesday, February 10, 2010

Page 36: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Russian

26Wednesday, February 10, 2010

Page 37: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Korean

27Wednesday, February 10, 2010

Page 38: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Japanese Romaji

28Wednesday, February 10, 2010

Page 39: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Japanese Kana

29Wednesday, February 10, 2010

Page 40: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Chinese Pinyin

30Wednesday, February 10, 2010

Page 41: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Chinese Handwriting

Simplified Traditional

31Wednesday, February 10, 2010

Page 42: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Customizing Text Input

32Wednesday, February 10, 2010

Page 43: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text Containers

33Wednesday, February 10, 2010

Page 44: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text Containers

DelegatesNotifications

Methods

34Wednesday, February 10, 2010

Page 45: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text Containers

Text Input Traits

35Wednesday, February 10, 2010

Page 46: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text Input Traits

ProtocolUITextFieldUITextView

36Wednesday, February 10, 2010

Page 47: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text Input Traits

Autocapitalization

Autocorrection

Keyboard Type

Keyboard Appearance

Return Key Type

Return Key Autoenabling

Secure Text Entry

37Wednesday, February 10, 2010

Page 48: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

URL KeyboardGo button

Text Input Traits

38Wednesday, February 10, 2010

Page 49: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Default KeyboardGoogle button

Text Input Traits

39Wednesday, February 10, 2010

Page 50: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text ContainersText Input Traits

DelegatesNotifications

Methods

40Wednesday, February 10, 2010

Page 51: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text Containers

41Wednesday, February 10, 2010

Page 52: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

UITextField

Design time

42Wednesday, February 10, 2010

Page 53: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Design time

URL KeyboardGo button

UITextField

43Wednesday, February 10, 2010

Page 54: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Run time

URL KeyboardGo button

UITextField

44Wednesday, February 10, 2010

Page 55: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Become first responder

URL KeyboardGo button

UITextField

45Wednesday, February 10, 2010

Page 56: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Keyboard

Become first responder

URL KeyboardGo button

UITextField

45Wednesday, February 10, 2010

Page 57: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Keyboard

Become first responder

URL KeyboardGo button

UITextField

46Wednesday, February 10, 2010

Page 58: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Keyboard

Become first responder

URL KeyboardGo button

UITextField

46Wednesday, February 10, 2010

Page 59: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Keyboard

Keyboard adopts traits

URL KeyboardGo button

UITextFieldURL KeyboardGo button

47Wednesday, February 10, 2010

Page 60: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Keyboard

Keyboard adopts traits

URL KeyboardGo button

UITextFieldURL KeyboardGo button

47Wednesday, February 10, 2010

Page 61: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Text Containers

UITextField

UITextView

Web Forms

48Wednesday, February 10, 2010

Page 62: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Demo:Text Input

49Wednesday, February 10, 2010

Page 63: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Presenting Content Modally

50Wednesday, February 10, 2010

Page 64: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

• For adding or picking data

Presenting Content Modally

51Wednesday, February 10, 2010

Page 65: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

• For adding or picking data

Presenting Content Modally

51Wednesday, February 10, 2010

Page 66: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

• For adding or picking data

Presenting Content Modally

51Wednesday, February 10, 2010

Page 67: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Presenting a View Controller

52Wednesday, February 10, 2010

Page 68: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Presenting a View Controller// Recipe list view controller- (void)showAddRecipe {

RecipeAddViewController *viewController = ...;[self presentModalViewController:viewController animated:YES];

}

52Wednesday, February 10, 2010

Page 69: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Presenting a View Controller// Recipe list view controller- (void)showAddRecipe {

RecipeAddViewController *viewController = ...;[self presentModalViewController:viewController animated:YES];

}

52Wednesday, February 10, 2010

Page 70: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a View Controller

53Wednesday, February 10, 2010

Page 71: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a View Controller// Recipe list view controller- (void)didAddRecipe {

[self dismissModalViewControllerAnimated:YES];}

53Wednesday, February 10, 2010

Page 72: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a View Controller// Recipe list view controller- (void)didAddRecipe {

[self dismissModalViewControllerAnimated:YES];}

53Wednesday, February 10, 2010

Page 73: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Separate Navigation Stacks

54Wednesday, February 10, 2010

Page 74: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Separate Navigation Stacks

54Wednesday, February 10, 2010

Page 75: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Separate Navigation Stacks

54Wednesday, February 10, 2010

Page 76: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Separate Navigation Stacks

54Wednesday, February 10, 2010

Page 77: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Separate Navigation Stacks

54Wednesday, February 10, 2010

Page 78: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller

55Wednesday, February 10, 2010

Page 79: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?

55Wednesday, February 10, 2010

Page 80: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

55Wednesday, February 10, 2010

Page 81: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller

55Wednesday, February 10, 2010

Page 82: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller■ Tell the delegate when the presented controller is done

55Wednesday, February 10, 2010

Page 83: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller■ Tell the delegate when the presented controller is done■ The delegate makes the call to dismiss

55Wednesday, February 10, 2010

Page 84: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller■ Tell the delegate when the presented controller is done■ The delegate makes the call to dismiss

Parent Controller

55Wednesday, February 10, 2010

Page 85: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller■ Tell the delegate when the presented controller is done■ The delegate makes the call to dismiss

Parent Controller

Child Controller

Present

55Wednesday, February 10, 2010

Page 86: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller■ Tell the delegate when the presented controller is done■ The delegate makes the call to dismiss

Parent Controller

Child Controller

I’m done!

55Wednesday, February 10, 2010

Page 87: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller■ Tell the delegate when the presented controller is done■ The delegate makes the call to dismiss

Parent Controller

Child Controller

Dismiss

55Wednesday, February 10, 2010

Page 88: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Dismissing a Modal View Controller• Who should do it?• Best practice is for the same object to call present and dismiss

• Define delegate methods for the presented controller■ Tell the delegate when the presented controller is done■ The delegate makes the call to dismiss

Parent Controller

55Wednesday, February 10, 2010

Page 89: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Demo:Presenting Content Modally

56Wednesday, February 10, 2010

Page 90: CS193P - Lecture 11 · iPhone Application Development Text Input Presenting Content Modally Wednesday, February 10, 2010 1 ... •Paparazzi 3 assignment is due Wednesday 2/17 •This

Questions?

57Wednesday, February 10, 2010