ComicMind Material TextField 色调颜色未更改
ComicMind Material TextField Tint Color Not Changing
我已阅读 guidelines for contributing of Cosmic Mind Material library for iOS。我似乎无法更改 TextField 的色调或光标。
这是我的类别代码:
func setupCustomTextField(textColor: UIColor, placeHolder: String?, delegate: UITextFieldDelegate) -> TextField? {
guard let materialSelf = self as? TextField else {
return nil
}
materialSelf.backgroundColor = .clear
materialSelf.textColor = textColor
materialSelf.borderColor = textColor
materialSelf.isClearIconButtonEnabled = true
materialSelf.delegate = delegate
materialSelf.dividerNormalColor = textColor
materialSelf.dividerActiveColor = textColor
materialSelf.tintColor = textColor
materialSelf.font = R.font.latoRegular(size: 15)
if let placeHolder = placeHolder {
let localizedPlaceHolder = NSLocalizedString(placeHolder, comment: "")
let attributedString = NSAttributedString(string: localizedPlaceHolder,
attributes: [NSForegroundColorAttributeName: textColor])
materialSelf.attributedPlaceholder = attributedString
}
return materialSelf
}
结果:
以下是您要更改的着色属性:
textField.placeholderNormalColor = Color.amber.darken4
textField.placeholderActiveColor = Color.pink.base
textField.dividerNormalColor = Color.cyan.base
textField.dividerActiveColor = Color.green.base
祝一切顺利:)
我已阅读 guidelines for contributing of Cosmic Mind Material library for iOS。我似乎无法更改 TextField 的色调或光标。
这是我的类别代码:
func setupCustomTextField(textColor: UIColor, placeHolder: String?, delegate: UITextFieldDelegate) -> TextField? {
guard let materialSelf = self as? TextField else {
return nil
}
materialSelf.backgroundColor = .clear
materialSelf.textColor = textColor
materialSelf.borderColor = textColor
materialSelf.isClearIconButtonEnabled = true
materialSelf.delegate = delegate
materialSelf.dividerNormalColor = textColor
materialSelf.dividerActiveColor = textColor
materialSelf.tintColor = textColor
materialSelf.font = R.font.latoRegular(size: 15)
if let placeHolder = placeHolder {
let localizedPlaceHolder = NSLocalizedString(placeHolder, comment: "")
let attributedString = NSAttributedString(string: localizedPlaceHolder,
attributes: [NSForegroundColorAttributeName: textColor])
materialSelf.attributedPlaceholder = attributedString
}
return materialSelf
}
结果:
以下是您要更改的着色属性:
textField.placeholderNormalColor = Color.amber.darken4
textField.placeholderActiveColor = Color.pink.base
textField.dividerNormalColor = Color.cyan.base
textField.dividerActiveColor = Color.green.base
祝一切顺利:)