2015-02-24 99 views
0

我需要在UIAlertView中放入5 UITextField。我用这个项目: https://www.cocoacontrols.com/controls/aralertcontroller在UIAlertview中添加多个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 presentInViewController:self animated:YES completion:nil]; 

有人可以帮助我实现我的?

感谢

回答

0

你必须使用类似:

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]; 

好路。

+0

好的,谢谢@benhi我试试看... – benhi 2015-02-24 12:14:35

相关问题