アクション シートを使用する iPhone アプリを持っていますが、ボタンの 1 つを押したときに新しいビューを開く方法がわかりません。アクション シートの実装方法は知っています。それは問題ではありません。新しいビューを開く実際のアクションが問題です。
どんな助けでも大歓迎です。ありがとう。
アクション シートを使用する iPhone アプリを持っていますが、ボタンの 1 つを押したときに新しいビューを開く方法がわかりません。アクション シートの実装方法は知っています。それは問題ではありません。新しいビューを開く実際のアクションが問題です。
どんな助けでも大歓迎です。ありがとう。
私は通常、新しいメソッドを作成し、アクションシートにそれを実行させます。
例えば:
switch (buttonIndex) {
case 0:
[self openModalView];
break;
}
次に、あなたのopenModalView
方法で:
- (void)openModalView {
MyModalViewController *myController = [[MyModalViewController alloc] init];
[self presentModalViewController:myController animated:YES];
[myController release];
}
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;
}
}