我嘗試在ios中使用UIActionController來顯示文本字段,並且我想知道如何更改文本字段邊框顏色。如何更改UIAlertController的文本框邊框顏色
我的代碼是:
- (void)showChangePasswordAlertView
{
UIAlertController *actionVC = [UIAlertController alertControllerWithTitle:@""
message:@"Change your password."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
}];
[actionVC addAction:action];
action = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
}];
[actionVC addAction:action];
[actionVC addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"old password";
textField.borderStyle = UITextBorderStyleNone;
textField.layer.borderColor = [UIColor redColor].CGColor;
textField.layer.borderWidth = 1.0 ;
textField.secureTextEntry = YES ;
}];
[actionVC addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"new password";
textField.borderStyle = UITextBorderStyleNone;
textField.secureTextEntry = YES ;
}];
[actionVC addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"confirm new password";
textField.borderStyle = UITextBorderStyleNone;
textField.secureTextEntry = YES ;
}];
[self presentViewController:actionVC animated:YES completion:nil];
}
但結果是:
任何身體知道該怎麼辦?謝謝。
您是否解決了問題? – 2015-02-12 11:51:37