UIAlertController的文本字段宽度比平常小

the*_*Guy 6 objective-c ios uialertcontroller xcode7

所以我有一个UIAlertControllerUITextField添加的输入,但由于某些原因,文本框似乎远远小于它应该是.知道为什么吗?

这是截图

警报视图文本域图像

这是守则

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"This is title"
                                                               message:@"This is message"
                                                        preferredStyle:UIAlertControllerStyleAlert];

[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {

    textField.keyboardType = UIKeyboardTypeNumberPad;
    textField.placeholder = @"I am a placeholder";

}];


UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Submit"
                                              style:UIAlertActionStyleDefault
                                            handler:nil];

[alert addAction:okAction];


[self presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

谢谢!

the*_*Guy 1

这是一个非常有趣的错误。我们正在进行的项目有一个名为 Pixate Freestyle 的库,它使用 CSS 来设计应用程序元素的样式。它通过样式来破坏文本字段。我们将其从项目中删除并对其进行了原生设计。问题解决了。希望这可以帮助!