Wednesday, July 18, 2012

Segue (not segway)

Segue's in iOS are a way to move from one MVC to another.  Segues are in storyboards and storyboards are only available in iOS5.
  • push - in a UINavigationController
  • replace - replaces right-hand side of UISplitViewController (iPad only)
  • popover - puts view controller on screen in a popover (iPad only)
  • modal - puts view controller up in a  way that blocks the app until it is dismissed
  • custom - create your own subclasses of UIStoryboardSegue

[self performSegueWithIdentifier:@"MySegueIdentifierHere" sender:self];

Before the new storyboard

- (void) prepareForSegue:(UIStoryboardSegue *)segue
{
  if ([segue.identifier isEqualToString:@"MySegueIdentifierHere"]) {
    UIViewController *newController = segue.destinationViewController;
    // send messages to the newController to get it ready for screen
    // but, the segue actually does the work of putting the new controller on screen
  }
}



No comments:

Post a Comment