ios8 UIAlertView成为密码UITextField无法正常工作的第一个响应者

dre*_*arp 6 objective-c uialertview ios8

这在iOS7中运行正常.升级到iOS8后,奇怪的是无法正常工作.

因此,如果用户之前已登录,则会保存用户名并需要密码.简单地说,我只是输入在0索引的用户名UITextField,并在1个索引设置光标UITextFieldUIAlertView.

之前,我不得不设置becomeFirstResponder为数字1指数UITextFieldUIAlertView.奇怪的是,我实际上可以将文本设置为1号索引UITextField.所以我知道我正在访问UITextField正确的.

非常简单的代码.

这是我的代码......

- (IBAction)actionTesting:(id)sender {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login" message:@"" delegate:self cancelButtonTitle:@"Login" otherButtonTitles: nil];
    alert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
    alert.tag = 999;

    UITextField *txtUserName = [alert textFieldAtIndex:0];
    UITextField *txtPassword = [alert textFieldAtIndex:1];

    txtUserName.text = @"";
    txtPassword.text = @"";

    [alert textFieldAtIndex:1].delegate = self;
    [alert show];
}

-(void)didPresentAlertView:(UIAlertView *)alertView{
    UITextField *txtUserName = [alertView textFieldAtIndex:0];
    UITextField *txtPassword = [alertView textFieldAtIndex:1];
    txtUserName.text = @"username";
    txtPassword.text = @"password";
    [txtPassword becomeFirstResponder];
}
Run Code Online (Sandbox Code Playgroud)

看起来我们有一个新的UIAlertController可用.我只是希望能够正常工作,所以我现在不需要对原始代码进行任何更改.

dre*_*arp 0

看起来苹果已经纠正了这个问题。前几天我才注意到该功能正在运行