我正在使用这段代码来显示 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];
最佳答案
我正在修复其他人代码的错误,最后发现有一些类别正在改变它的行为。
关于ios9 UIAlertController uitextfield 太小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37770180/