Commit 3c738247 by Daniel Dahan

development: fixed alignment when initially calling on

parent 89833757
......@@ -50,7 +50,7 @@ public class TextField: UITextField {
}
/// Reference to the divider.
public private(set) lazy var divider: CAShapeLayer = CAShapeLayer()
public private(set) var divider: CAShapeLayer!
/// Divider height.
@IBInspectable public var dividerHeight: CGFloat = 1
......@@ -108,7 +108,7 @@ public class TextField: UITextField {
}
/// The placeholder UILabel.
@IBInspectable public private(set) lazy var placeholderLabel: UILabel = UILabel(frame: CGRect.zero)
@IBInspectable public private(set) var placeholderLabel: UILabel!
/// Placeholder textColor.
@IBInspectable public var placeholderColor: UIColor = Color.darkText.others {
......@@ -291,7 +291,6 @@ public class TextField: UITextField {
public override func layoutSubviews() {
super.layoutSubviews()
layoutToSize()
}
......@@ -305,6 +304,7 @@ public class TextField: UITextField {
/// Handles the text editing did begin state.
public func handleEditingDidBegin() {
layoutIfNeeded()
dividerEditingDidBeginAnimation()
placeholderEditingDidBeginAnimation()
}
......@@ -346,7 +346,6 @@ public class TextField: UITextField {
borderStyle = .none
backgroundColor = nil
textColor = Color.darkText.primary
font = RobotoFont.regularWithSize(size: 16)
contentScaleFactor = Device.scale
prepareDivider()
preparePlaceholderLabel()
......@@ -482,13 +481,16 @@ public class TextField: UITextField {
/// Prepares the divider.
private func prepareDivider() {
divider = CAShapeLayer()
dividerColor = Color.darkText.dividers
layer.addSublayer(divider)
}
/// Prepares the placeholderLabel.
private func preparePlaceholderLabel() {
placeholderLabel = UILabel(frame: CGRect.zero)
placeholderColor = Color.darkText.others
font = RobotoFont.regularWithSize(size: 16)
addSubview(placeholderLabel)
}
......
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