Modale Dialoge
Alerts
Beispiel Alerts
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Title"
message:@"Message"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Other", nil];
[alert show];
[alert release];
Action Sheets
Beispiel Action Sheet
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destructive Button"
otherButtonTitles:nil];
[actionSheet showInView:someView];
[actionSheet release];
Beispiel Action Sheet (UIActionSheetDelegate)
- (void) actionSheet: (UIActionSheet*) actionSheet
clickedButtonAtIndex:(NSInteger) buttonIndex {
if (buttonIndex == [actionSheet destructiveButtonIndex]) {
// ...
}
}
Modale View-Controller
- View-Controller können andere View-Controller modal anzeigen.
- Dabei wird der gesamte View-Bereich inkl. der Navigation Bar überdeckt.
- Anzeige erfolgt mit
presentModalViewController: animated: - Schließen erfolgt mit
dismissModalViewControllerAnimated:
Beispielcode: Modaler View-Controller mit Navigation-Bar
UIViewController* someViewController = [[SomeViewController alloc] init];
UINavigationController *modalNavController = [[UINavigationController alloc]
initWithRootViewController:someViewController];
[self.navigationController presentModalViewController:modalNavController
animated:YES];
[someViewController release];
[navController release];
Weitere Informationen
- Beispielanwendung
UICatalog>AlertsViewController

