【发布时间】:2016-06-29 10:49:00
【问题描述】:
如何设置 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]}];
默认焦点转到电子邮件文本字段。然后电子邮件文本字段占位符颜色为黑色。
如果焦点转到密码文本字段,则电子邮件文本字段的占位符文本颜色仍为黑色。
【问题讨论】:
标签: objective-c uitextfield tvos apple-tv