Я пробовал это сегодня вечером некоторое время ... У меня есть UIActionSheet в его собственном контроллере. Я импортирую контроллер в том виде, в котором я хотел бы, чтобы он отображался. Я не могу понять, как сделать так, чтобы новый вид отображался, когда пользователь нажимает одну из кнопок (вы можете видеть, куда я сейчас отправляю предупреждение) Есть идеи?
- (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;
}
}
Вот картинка из того, что я пытаюсь сделать ... Когда пользователь нажимает кнопку «Справка», появляется новый вид. Когда пользователь нажимает кнопку «Кредиты», отображается другое представление. Я использую IB для создания представлений.