【发布时间】:2014-08-10 05:35:57
【问题描述】:
我正在尝试使用以下代码(RGBA 值)更改 UITextField 中的文本颜色,但是它只是显示为白色或清晰,我不太确定,因为背景本身是白色的。
passwordTextField.textColor = UIColor(red: CGFloat(202.0), green: CGFloat(228.0), blue: CGFloat(230.0), alpha: CGFloat(100.0))
passwordTextField.returnKeyType = UIReturnKeyType.Done
passwordTextField.placeholder = "Password"
passwordTextField.backgroundColor = UIColor.clearColor()
passwordTextField.borderStyle = UITextBorderStyle.RoundedRect
passwordTextField.font = UIFont(name: "Avenir Next", size: 14)
passwordTextField.textAlignment = NSTextAlignment.Center
passwordTextField.secureTextEntry = true
【问题讨论】:
-
202.0/255.0,228.0/255.0,230.0/255.0, 等等...这些值应该在0.0和1.0之间...