3

私はこの問題の解決策をインターネットで探していましたが、理解できるものを見つけられませんでした。それで、ここに行きます。アプリケーションの最初の起動時に UIAlertView を表示する iOS アプリケーションがあります。ボタンの 1 つでユーザーを新しい viewController に送り、いくつかの重要な情報を表示したいと考えています。

UIAlertView を適切に構成しました。actionSheet のコードは次のとおりです。

- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0)
{

//Code to open a new viewController???


}

if (buttonIndex == 1)
{

//User can exit the application if they do not wish to continue

exit(0);    }

}
}

私は、webViewViewController という名前の viewController を作成しました。これは、ユーザーが最初のボタンをタップしたときに到達できるようにしたいものです。これを行う方法についてのアイデアはありますか?ARC を無効にしていますが、他の「解決策」でエラーが発生し続けます。

ありがとうございます。ここでいくつかのガイダンスをいただければ幸いです。

4

3 に答える 3

0

現在のビュー コントローラーがナビゲーション コントローラーにある場合:

UIViewController *myViewController = [[UIViewController alloc] init];
myViewController.title = @"My First View";
//to push the UIView.
[self.navigationController pushViewController:myViewController animated:YES];

exit(0) は絶対に使用しないでください。

于 2013-01-21T11:56:40.490 に答える
0

使用する:

UIViewController *yourViewController = [[UIViewController alloc] init];
[self.navigationController presentModalViewController:myViewController animated:YES];

modalViewController をプッシュします (これは iOS 6 では廃止されていますが、動作します)。

于 2013-01-21T12:54:57.683 に答える
0
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0)
{

 NewViewController *controller=[[NewViewController alloc]initWithNibName:@"NewViewController" bundle:nil];
            self.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
            [self presentViewController:controller animated:YES completion:nil];



}           

drasick は十分な回答を提供していますが、モデル ビュー コントローラーを使用する必要がある場合は、上記を参照してください。

于 2013-01-21T12:11:06.720 に答える