1

アプリケーションでコードを実行しているときにエラーが発生しました。タスクは、アラート後にURLにリダイレクトすることです。しかし、コードについては私が推測することは正しいです。そして、これが私のコードです

- (void) alertStatus:(NSString *)msg :(NSString *)title :(int)tag
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
                                                       message:msg
                                                       delegate:self
                                               cancelButtonTitle:@"Ok"
                                              otherButtonTitles:nil, nil];
    if (tag) alert.tag = tag;
    {
    [alertView show];
    }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if(alertView.tag == 101)
    {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://ABC.company.com"]];
        //[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
    }
}

エラーは行に表示されています

if (tag) alert.tag = tag;(Use of undeclared identifier:alert)
4

1 に答える 1

0

いくつかの...エラー(省略)があります

  • - (void) alertStatus:(NSString *)msg **withTitle**:(NSString *)title **andTag**:(int)tag
  • if (tag) alert.tag = tag;// ただし、前に宣言するalertView
于 2013-02-09T11:05:53.713 に答える