Commit 9c3c58e6 by Daniel Dahan

development: minor updates to TextField when updating placeholder text color

parent c0b0aa1a
......@@ -465,20 +465,12 @@ extension TextField {
/// Updates the placeholderLabel attributedText.
fileprivate func updatePlaceholderLabelColor() {
guard let v = placeholder else {
return
}
placeholderLabel.textColor = isEditing ? placeholderActiveColor : placeholderNormalColor
}
/// Updates the detailLabel attributedText.
fileprivate func updateDetailLabelColor() {
guard let v = detail else {
return
}
detailLabel.attributedText = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: detailColor])
detailLabel.textColor = detailColor
}
}
......@@ -610,6 +602,8 @@ extension TextField {
/// The animation for the placeholder when editing begins.
fileprivate func placeholderEditingDidBeginAnimation() {
updatePlaceholderLabelColor()
guard isPlaceholderAnimated else {
return
}
......@@ -618,8 +612,6 @@ extension TextField {
return
}
updatePlaceholderLabelColor()
isAnimating = true
UIView.animate(withDuration: 0.15, animations: { [weak self] in
guard let s = self else {
......@@ -644,6 +636,8 @@ extension TextField {
/// The animation for the placeholder when editing ends.
fileprivate func placeholderEditingDidEndAnimation() {
updatePlaceholderLabelColor()
guard isPlaceholderAnimated else {
return
}
......@@ -661,7 +655,6 @@ extension TextField {
s.placeholderLabel.transform = CGAffineTransform.identity
s.placeholderLabel.x = s.leftViewWidth
s.placeholderLabel.y = 0
s.placeholderLabel.textColor = s.placeholderNormalColor
}) { [weak self] _ in
self?.isAnimating = false
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment