diff --git a/AnimatedTextInput/Classes/AnimatedTextInput.swift b/AnimatedTextInput/Classes/AnimatedTextInput.swift index c258aa8..c69f145 100755 --- a/AnimatedTextInput/Classes/AnimatedTextInput.swift +++ b/AnimatedTextInput/Classes/AnimatedTextInput.swift @@ -251,7 +251,7 @@ open class AnimatedTextInput: UIControl { } fileprivate func layoutPlaceholderLayer() { - placeholderLayer.frame = CGRect(origin: placeholderPosition, size: CGSize(width: bounds.width, height: (style.textInputFont.pointSize * CGFloat(self.frameHeightCorrectionFactor)) )) + placeholderLayer.frame = CGRect(origin: placeholderPosition, size: CGSize(width: bounds.width, height: (style.placeHolderFont.pointSize * CGFloat(self.frameHeightCorrectionFactor)) )) } // mark: Configuration @@ -292,8 +292,8 @@ open class AnimatedTextInput: UIControl { placeholderLayer.masksToBounds = false placeholderLayer.string = placeHolderText placeholderLayer.foregroundColor = style.placeholderInactiveColor.cgColor - placeholderLayer.fontSize = style.textInputFont.pointSize - placeholderLayer.font = style.textInputFont + placeholderLayer.fontSize = style.placeHolderFont.pointSize + placeholderLayer.font = style.placeHolderFont placeholderLayer.contentsScale = UIScreen.main.scale placeholderLayer.backgroundColor = UIColor.clear.cgColor layoutPlaceholderLayer() @@ -344,7 +344,7 @@ open class AnimatedTextInput: UIControl { fileprivate func configurePlaceholderAsDefault() { isPlaceholderAsHint = false - configurePlaceholderWith(fontSize: style.textInputFont.pointSize, + configurePlaceholderWith(fontSize: style.placeHolderFont.pointSize, foregroundColor: style.placeholderInactiveColor.cgColor, text: placeHolderText) lineView.animateToInitialState() @@ -385,9 +385,9 @@ open class AnimatedTextInput: UIControl { fileprivate func styleDidChange() { lineView.defaultColor = style.lineInactiveColor placeholderLayer.foregroundColor = style.placeholderInactiveColor.cgColor - let fontSize = style.textInputFont.pointSize + let fontSize = style.placeHolderFont.pointSize placeholderLayer.fontSize = fontSize - placeholderLayer.font = style.textInputFont + placeholderLayer.font = style.placeHolderFont textInput.view.tintColor = style.activeColor textInput.textColor = style.textInputFontColor textInput.font = style.textInputFont diff --git a/AnimatedTextInput/Classes/AnimatedTextInputStyle.swift b/AnimatedTextInput/Classes/AnimatedTextInputStyle.swift index 5c81b76..1aad94f 100644 --- a/AnimatedTextInput/Classes/AnimatedTextInputStyle.swift +++ b/AnimatedTextInput/Classes/AnimatedTextInputStyle.swift @@ -9,6 +9,7 @@ public protocol AnimatedTextInputStyle { var lineHeight: CGFloat { get } var errorColor: UIColor { get } var textInputFont: UIFont { get } + var placeHolderFont: UIFont { get } var textInputFontColor: UIColor { get } var placeholderMinFontSize: CGFloat { get } var counterLabelFont: UIFont? { get } @@ -31,6 +32,7 @@ public struct AnimatedTextInputStyleBlue: AnimatedTextInputStyle { public let lineHeight: CGFloat = 1.0 / UIScreen.main.scale public let errorColor = UIColor.red public let textInputFont = UIFont.systemFont(ofSize: 14) + public let placeHolderFont = UIFont.systemFont(ofSize: 14) public let textInputFontColor = UIColor.black public let placeholderMinFontSize: CGFloat = 9 public let counterLabelFont: UIFont? = UIFont.systemFont(ofSize: 9)