UITwoSidedAlertController

From iPhone Development Wiki
Jump to: navigation, search

UITwoSidedAlertController is a controller which manages two UIAlertViews. These alert views can be switched with a flip animation to emulate a "two-sided" view.

Example code:

UITwoSidedAlertController* controller = [[UITwoSidedAlertController alloc] init];
 
// By default the front alert's button dismisses the alert view.
UIAlertView* frontAlert = [controller frontAlert];
[frontAlert addButtonWithTitle:@"Detail..."];
frontAlert.message = @"Houston, we've had a problem";
frontAlert.delegate = self;
 
// By default the back alert's button flip back to the front alert.
UIAlertView* backAlert = [controller backAlert];
backAlert.message = @"Service propulsion system engine valve body temperature begins a rise of 1.65°F in 7 seconds. DC main A decreases 0.9 V...";
 
[controller show];
 
...
 
-(void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
  if (buttonIndex == 0)
    [controller dismiss];
  else
    [controller flip];
}

References