【发布时间】:2016-06-12 02:29:03
【问题描述】:
我正在使用此代码显示 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];
【问题讨论】:
标签: ios ios9 uialertview uialertcontroller