J'ai essayé celui-ci ce soir pendant un certain temps .... J'ai une UIActionSheet dans son propre contrôleur. J'importe le contrôleur dans la vue je voudrais qu'il soit affiché. Je n'arrive pas à comprendre comment afficher une nouvelle vue lorsque l'utilisateur appuie sur l'un des boutons (vous pouvez voir où je viens d'envoyer une alerte maintenant). Des idées?UIActionSheet Button chargement d'une nouvelle vue
- (void)helpButtonPressedView {
// open a dialog with two custom buttons
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@""
delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
otherButtonTitles:@"Help", @"Credits", nil];
[self parentViewController];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table)
[actionSheet release];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"Button Pressed: %d",buttonIndex);
int btn = buttonIndex;
UIAlertView *alert;
switch (btn) {
case 0:
// help screen
alert = [[UIAlertView alloc] initWithTitle:@"Button Press Notice" message:@"The Help screen will be dispayed"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
// helpViewController = [[HelpViewController alloc] init];
// [self presentModalViewController:helpViewController animated:YES];
break;
case 1:
// credits screen
alert = [[UIAlertView alloc] initWithTitle:@"Button Press Notice" message:@"The Credits screen will be dispayed"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
break;
default:
break;
}
}
Voici une photo de ce que je suis en train de faire ... Lorsque l'utilisateur appuie sur le bouton « Aide », selon une nouvelle vue. Lorsque l'utilisateur appuie sur le bouton "Crédits", une vue différente apparaît. J'utilise IB pour créer les vues.
Il serait utile que vous expliquiez un peu plus ce que vous essayez de faire visuellement. –