Lecture 15

Lecture 15 - Stanford CS193p Fall 2011 Developing...

Info iconThis preview shows pages 1–6. 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
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 Modal View Controllers View Controllers that take over the screen. UITextField and UITextView Inputting text. UIView Animation Making changes to a UIView and having the result be shown over time. NSTimer Doing things on a scheduled basis. Stanford CS193p Fall 2011 Modal View Controllers Making a view controllers view appear temporarily And blocking all other navigation in the application until the user has dealt with this view. Stanford CS193p Fall 2011 Modal View Controllers This is what we mean by segueing to a View Controller modally Modally means in a mode: nothing else can go on while that other View Controller is up. There are different transition styles and presentation styles (more on this in a moment). Just ctrl-drag from a button to the modal View Controller. Inspect segue to set style. Can be done from code as well (less common) Example. Putting up a modal view that asks the user to nd an address.- (IBAction)lookupAddress { AddressLookupViewController *alvc = [self.storyboard instantiateViewControllerWithIdentifier:@AddressLookup]; [self presentModalViewController:alvc animated:YES completion:^{ // alvc is now on screen; often we do nothing here }]; } This method will ll the entire screen with alvc s view and immediately return after the block. The user will then not be able to do anything except interact with alvc s view. Stanford CS193p Fall 2011 Modal View Controllers So when does it all end?! It stays this way until someone sends this message to the view controller which put alvc up ...- (void)dismissModalViewControllerAnimated:(BOOL)animated; You do NOT send this to alvc ! You send it to the view controller that presented alvc . (i.e. the one that implements the method lookupAddress above). Modal view controllers dismissing themselves This is generally frowned upon. However, it sometimes happens on cancel (i.e. the user did nothing in the modal view controller). But you still do it by sending dismissModalViewController: to the presenting view controller: [[self presentingViewController] dismissModalViewController:YES]; So if dismissing oneself is frowned upon, how does it happen? Using delegation. Stanford CS193p Fall 2011 Modal View Controllers So when does it all end?! It stays this way until someone sends this message to the view controller which put alvc up ...- (void)dismissModalViewControllerAnimated:(BOOL)animated; You do NOT send this to alvc ! You send it to the view controller that presented alvc . (i.e. the one that implements the method lookupAddress above). Modal view controllers dismissing themselves This is generally frowned upon....
View Full Document

Page1 / 19

Lecture 15 - Stanford CS193p Fall 2011 Developing...

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