我添加了显示登录和密码文本字段的UIAlertController代码,它适用于iOS 8但在iOS 9中不起作用.文本字段缩小,如下图所示 
我正在尝试的代码如下:
- (void)toggleLoginLdap:(UIViewController *)currentVC
{
if ([UIAlertController class])
{
self.alertController= [UIAlertController
alertControllerWithTitle:@"Title of Msg"
message:@"Hello"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action){
NSString *userName = self.alertController.textFields[0].text;
NSString *password = self.alertController.textFields[1].text;
}];
UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
[self.alertController dismissViewControllerAnimated:YES completion:nil];
}];
[self.alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Username/Email";
//textField.preservesSuperviewLayoutMargins = YES;
textField.autoresizesSubviews = YES;
}];
[self.alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Password";
textField.secureTextEntry = YES;
}];
//alertController.view.autoresizesSubviews = YES;
[self.alertController …Run Code Online (Sandbox Code Playgroud)