iOS开发:UIAlertView使用的问题

来源:互联网 发布:php网络验证源码 编辑:程序博客网 时间:2024/04/30 11:29
UIAlertView使用,代码如下:
定义:
UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"提示" message:@"预约信息已提交!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
 [alert show];
 alertFlag = 0;

委托:
//”警告框“按钮响应
- (void)alertView:(UIAlertView *)alertView
didDismissWithButtonIndex:(NSInteger)buttonIndex{
    if (alertFlag == 0) {
        if(buttonIndex == [alertView cancelButtonIndex])
        {
            NSLog(@"“预约”确定...");
        }
    }
}

按照此方法使用,结果会报错:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'textFieldIndex (0) is outside of the bounds of the array of text fields'

请问各位大侠,这是什么原因?该如何修正?谢谢,谢谢!
0 0