ios9 UIAlertController uitextfield 太小

标签 ios ios9 uialertview uialertcontroller

我正在使用这段代码来显示 UIAlert,它将询问简单的输入

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Alert" message:@"Message" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"Click" style:UIAlertActionStyleDefault handler:nil]];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    textField.placeholder = @"Enter text:";
}];
[self presentViewController:alert animated:YES completion:nil];

也试过iOS 7的这段代码

UIAlertView *alertViewCustomQuestion=[[UIAlertView alloc]initWithTitle:@"Custom Question" message:@"Please enter your custom question!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil];
alertViewCustomQuestion.alertViewStyle=UIAlertViewStylePlainTextInput;
[alertViewCustomQuestion show];

两者显示相同的结果。虽然我看到的任何例子都有很好的宽度。 enter image description here

最佳答案

我正在修复其他人代码的错误,最后发现有一些类别正在改变它的行为。

关于ios9 UIAlertController uitextfield 太小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37770180/

相关文章:

ios - 将图像添加到 NSObject - 可能吗?

ios - 使用 GL_Trianglestrip OpenGL ES 2.0 绘制四边形元素

ios - BLE iOS9 的 Swift 后台模式

ios - 使用 UIApplicationShortcutItem 启动

与 Lynda 一起学习 iOS : Getting error can't invoke 'init' with argument of type @lvalue String

ios - 使用 UIAlertController 时键盘延迟

ios - 在 iOS 中按下返回按钮时如何创建确认弹出窗口?

ios - 如何检测 iOS 应用程序是否正在越狱手机上运行?

ios - 未调用 UIAlertView 子类中的 alertViewShouldEnableFirstOtherButton

iphone - 来自 UIAlertView 的 UIActionSheet