Commit 554456a9 by Daniel Dahan

updated alignemnts for TextField based on PR 402

parent 29775685
...@@ -228,6 +228,13 @@ public class TextField : UITextField { ...@@ -228,6 +228,13 @@ public class TextField : UITextField {
} }
} }
/// Vertical distance for the detailLabel from the divider.
@IBInspectable public var detailVerticalDistanceFromDivider: CGFloat = 8 {
didSet {
layoutDetailLabel()
}
}
/// Handles the textAlignment of the placeholderLabel. /// Handles the textAlignment of the placeholderLabel.
public override var textAlignment: NSTextAlignment { public override var textAlignment: NSTextAlignment {
get { get {
...@@ -322,6 +329,9 @@ public class TextField : UITextField { ...@@ -322,6 +329,9 @@ public class TextField : UITextField {
/// A reference to the visibilityIconButton. /// A reference to the visibilityIconButton.
public private(set) var visibilityIconButton: IconButton? public private(set) var visibilityIconButton: IconButton?
/// This property adds a padding to placeholder y position animation
public var placeholderVerticalAnimationOffset: CGFloat = 0
/** /**
An initializer that initializes the object with a NSCoder object. An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance. - Parameter aDecoder: A NSCoder instance.
...@@ -513,7 +523,7 @@ public class TextField : UITextField { ...@@ -513,7 +523,7 @@ public class TextField : UITextField {
/// Layout the detailLabel. /// Layout the detailLabel.
public func layoutDetailLabel() { public func layoutDetailLabel() {
let h: CGFloat = nil == detail ? 12 : detailLabel.font.stringSize(detail!, constrainedToWidth: Double(width)).height let h: CGFloat = nil == detail ? 12 : detailLabel.font.stringSize(detail!, constrainedToWidth: Double(width)).height
detailLabel.frame = CGRectMake(0, divider.frame.origin.y + 8, width, h) detailLabel.frame = CGRectMake(0, divider.frame.origin.y + detailVerticalDistanceFromDivider, width, h)
} }
/// Layout the clearIconButton. /// Layout the clearIconButton.
...@@ -560,7 +570,7 @@ public class TextField : UITextField { ...@@ -560,7 +570,7 @@ public class TextField : UITextField {
v.placeholderLabel.frame.origin.x = v.width - v.placeholderLabel.frame.width v.placeholderLabel.frame.origin.x = v.width - v.placeholderLabel.frame.width
default:break default:break
} }
v.placeholderLabel.frame.origin.y = -v.placeholderLabel.frame.size.height v.placeholderLabel.frame.origin.y = -v.placeholderLabel.frame.size.height + v.placeholderVerticalAnimationOffset
v.placeholderLabel.textColor = v.placeholderActiveColor v.placeholderLabel.textColor = v.placeholderActiveColor
} }
}) { [weak self] _ in }) { [weak self] _ in
......
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