2016-11-15 30 views
0

我有UIAlertView与文本字段。uialertview textfield隐形ios 10.1.1

UIAlertView *corrmsg=[[UIAlertView alloc] initWithTitle:@"" message:@"Enter Password" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",@"Forgot Password", nil]; 
    corrmsg.alertViewStyle = UIAlertViewStylePlainTextInput; 
    [corrmsg show]; 
    [corrmsg release]; 

在iPad上的iOS 9.1.1文本字段成为无形的,没有光标,没有包装,虽然键盘上来和工作正常,如果你只是一味地键入英寸

enter image description here

任何人有线索怎么解决这个问题?

切换到UIAlertController但这并没有帮助:(

 UIAlertController *alertController=[UIAlertController alertControllerWithTitle:@"" message:@"Enter Password" preferredStyle:UIAlertControllerStyleAlert]; 

    [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField){ 
     textField.placeholder = NSLocalizedString(@"Enter Password", @"Password"); 
    }]; 

    [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { 
     [self okBttn:alertController.textFields.firstObject.text]; 
    }]]; 
    [alertController addAction:[UIAlertAction actionWithTitle:@"Forgot Password" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { 
     [self forgotPasswordBttn]; 
    }]]; 
    [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { 
     [self cancelBttn]; 
    }]]; 
    [self presentViewController:alertController animated:YES completion:nil]; 
    [alertController release]; 

UPDATE:?提升部署目标> 9.0固定UIAlertController

+1

'UIAlertView'已被弃用一段时间了。使用'UIAlertController'。 – rmaddy

+0

嗨rmaddy,切换到UIAlertController - 同样的故事,任何其他想法? –

+0

将depl traget升级到> 9.0固定UIAlertController –

回答

0

凡茹配置UITextField 尝试smthn这样的:

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:(@"") 
                message:@"Enter Password" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; 
myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)]; 
[myTextField setBackgroundColor:[UIColor whiteColor]]; 
[myAlertView addSubview:myTextField]; 
[myAlertView show]; 
[myAlertView release]; 
} 
+0

因为我使用myAlertView.alertViewStyle = UIAlertViewStylePlainTextInput;我不需要,但是谢谢你的建议。我可以尝试[myAlertView textFieldAtIndex:0] .backgroundColor = [UIColor whiteColor];等等,但是,正如rmaddy指出的那样,它已被弃用,我将切换到UIAlertController以避免未来的不可预测性。 –

+0

1)'UIAlertView'已弃用。 2)不要创建自己的'UITextField'并将其添加到警报中。 'UIAlertView'已经支持添加文本字段。 3)你真的还在使用MRC而不是ARC吗? – rmaddy

+0

好的,rmaddy,我不会在已经存在的那个顶部添加textview,我可以访问它并进行编辑。这是一个旧的应用程序,是的,它是MRC。需要将其切换到ARC并提升其部署目标。 –