0

アクション シートを使用する iPhone アプリを持っていますが、ボタンの 1 つを押したときに新しいビューを開く方法がわかりません。アクション シートの実装方法は知っています。それは問題ではありません。新しいビューを開く実際のアクションが問題です。

どんな助けでも大歓迎です。ありがとう。

4

2 に答える 2

1

私は通常、新しいメソッドを作成し、アクションシートにそれを実行させます。

例えば:

switch (buttonIndex) {
    case 0:
        [self openModalView];
        break;
 }

次に、あなたのopenModalView方法で:

- (void)openModalView {
    MyModalViewController *myController = [[MyModalViewController alloc] init];
    [self presentModalViewController:myController animated:YES];
    [myController release];
}
于 2010-01-06T22:20:51.387 に答える
0

UIAlertViewの-didDismissWithButtonIndexで、新しいView Controllerをインスタンス化し、ナビゲーションスタックにプッシュします。

- (void)alertView:(UIAlertView *)alertView 
                 didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0)
    {
        NewViewController *controller = [[NewViewController alloc] init];
        [[self navigationController] pushViewController:controller animated:YES];
        [controller release], controller = nil;
    }
}
于 2010-01-06T22:20:49.200 に答える