我想允许用户输入多行文字。我正在使用UIAlertController这样做。以下是我使用的代码。
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"Remarks"
message:@"Please enter the remarks:"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
UITextField *email = alert.textFields.firstObject;
NSLog(@"%@",email.text);
if (![email.text isEqualToString:@""])
{
}
else
{
[self showMessage:@"Remark is mandatory" withTitle:@"Remarks!"];
}
}];
UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:ok];
[alert addAction:cancel];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Enter the remarks";
}];
[self presentViewController:alert animated:YES completion:nil];
问题是,