2015-02-24 47 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

相關問題