如何将文本字段添加到警报视图?我正在尝试做一个应用程序,在应用程序提交编辑之前,用户必须通过在所述警报视图上输入他/她的密码来进行第一次身份验证,但我该怎么做呢?我搜索的代码似乎不再起作用了。这里是:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log In" message:@"Please enter your Password" delegate:self cancelButtonTitle:@"Log In" otherButtonTitles:@"Cancel", nil];
[alert addTextFieldWithValue:@"" label:@"Password"];
UITextField *tf = [alert textFieldAtIndex:0];
tf.clearButtonMode = UITextFieldViewModeWhileEditing;
tf.keyboardType = UIKeyboardTypeAlphabet;
tf.keyboardAppearance = UIKeyboardAppearanceAlert;
tf.autocapitalizationType = UITextAutocapitalizationTypeWords;
tf.autocapitalizationType = UITextAutocorrectionTypeNo;
错误说
"No visible @interface for 'UIAlertView'
declares the selector 'addTextFieldWithValue:label:'"
on the [alert addTextFieldWithValue:@"" label:@"Password"];
我还想问一下如何将代码放在警报视图的确认按钮上。