在 UIAlertview 中添加多个 UITextfield

Add multiple UITextfield in UIAlertview

我需要在 UIAlertView 中放入 5 UITextField。我使用这个项目: https://www.cocoacontrols.com/controls/aralertcontroller

这是我的代码:

ARAlertController *alert = [ARAlertController alertControllerWithTitle:@"My Alert" message:@"This is an alert." preferredStyle:ARAlertControllerStyleAlert];
ARAlertAction* defaultAction = [ARAlertAction actionWithTitle:@"OK" style:ARAlertActionStyleDefault handler:^(ARAlertAction * action) {}];



[alert addAction:defaultAction];
[alert presentInViewController:self animated:YES completion:nil];

有人可以帮我在我的 (ARAlertController *)alert 中实现 5 UITextField 吗?

谢谢

你必须使用类似的东西:

ARAlertController *alert = [ARAlertController alertControllerWithTitle:@"My Alert" message:@"This is an alert." preferredStyle:ARAlertControllerStyleAlert];
ARAlertAction* defaultAction = [ARAlertAction actionWithTitle:@"OK" style:ARAlertActionStyleDefault handler:^(ARAlertAction * action) {}];
[alert addAction:defaultAction];

[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    textField.placeholder = @"First";
}];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    textField.placeholder = @"second";
}];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    textField.placeholder = @"third";
}];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    textField.placeholder = @"fourth";
}];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    textField.placeholder = @"fifth";
}];

[alert presentInViewController:self animated:YES completion:nil];

好运。