我想允许用户输入多行文本。我使用 UIAlertController 来做到这一点。以下是我使用的代码。
UIAlertController * alert= [UIAlertController
alertControllerWithTitle"Remarks"
message"lease 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 addActionk];
[alert addAction:cancel];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Enter the remarks";
}];
[self presentViewController:alert animated:YES completion:nil];
问题是,
使用自定义 iOS AlertView。这对我有帮助。
https://github.com/wimagguc/ios-custom-alertview
关于ios - 无法在 UIAlertController 中强加 textview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37937039/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |