2015/06/11

[iOS][Objective-C]UITextFieldのplaceholderの色を変更

UITextFieldのplaceholderの色を変更するにはどうすればいいのだろうか?
UITextFieldでPlaceholderの色を自由に変えるで確認すると以下のコードでいけるみたい。

UITextField *textField;
NSString *placeholder;
UIColor *color;
textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSForegroundColorAttributeName: color}];
確かに、これで組んだらいけた。

0 コメント:

コメントを投稿