0

新しいViewControllerにプッシュするようにAlertViewをプログラミングするのに問題があります。私はいくつかのチュートリアルに従いましたが、それでも正しく機能させることができませんでした。どんな助けでもいただければ幸いです。

- (IBAction)web:(id)sender {
    UIAlertView *testAlert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"You are now entering a website outside of the Company App: Any links or references to other Internet sites (hyperlinks) are provided by Company merely as a convenience to users of this App." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Proceed", nil];

        [testAlert show];
        [testAlert release];

}

-(void)web:(UIAlertView *)web clickedButtonAtIndex:(NSInteger)buttonIndex {

    if (buttonIndex == 0) {
    }
    else if (buttonIndex == 1) {

    JBWebViewController *jbweb = [[JBWebViewController alloc] initWithNibName:@"JBWebViewController" bundle:nil];
        [self.navigationController pushViewController:jbweb animated:YES];
    }
}
4

1 に答える 1

1

UIAlertViewデリゲートを使用する必要があります

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

いいえ

-(void)web:(UIAlertView *)web clickedButtonAtIndex:(NSInteger)buttonIndex

self.navigationController ではないことを確認しnilます。

于 2013-10-07T02:20:53.380 に答える