设置UITextfield Apple TV占位符文本的文本颜色

时间:2016-06-29 10:49:00

标签: objective-c uitextfield tvos apple-tv

如何在正常和聚焦状态下设置UITextfield的占位符文本的文本颜色。

我使用代码设置占位符文字颜色

self.emailTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Email Address" attributes:@{NSFontAttributeName:[UIFont fontWithName:@"OpenSans" size:24], NSForegroundColorAttributeName:[UIColor whiteColor]}];

self.passwordTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Password" attributes:@{NSFontAttributeName:[UIFont fontWithName:@"OpenSans" size:24], NSForegroundColorAttributeName:[UIColor whiteColor]}];

默认焦点转到电子邮件文本字段。然后电子邮件文本字段占位符颜色为黑色。

如果焦点转到密码文本字段,则电子邮件文本字段的占位符文本颜色仍为黑色。

0 个答案:

没有答案
相关问题