OStack程序员社区-中国程序员成长平台

标题: ios9 UIAlertController uitextfield 太小 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 16:59
标题: ios9 UIAlertController uitextfield 太小

我正在使用此代码显示 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"lease enter your custom question!" delegate:self cancelButtonTitle"Cancel" otherButtonTitles"Ok",nil];
alertViewCustomQuestion.alertViewStyle=UIAlertViewStylePlainTextInput;
[alertViewCustomQuestion show];

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



Best Answer-推荐答案


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

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






欢迎光临 OStack程序员社区-中国程序员成长平台 (http://ostack.cn/) Powered by Discuz! X3.4