Commit 030d3fb7 by Daniel Dahan

updated TextField and TextView with a better fix for the corpping text issue

parent 38e92483
......@@ -169,7 +169,6 @@ public class NavigationBarView : MaterialView {
}
public override func intrinsicContentSize() -> CGSize {
// General alignment.
switch UIDevice.currentDevice().orientation {
case .LandscapeLeft, .LandscapeRight:
return CGSizeMake(UIScreen.mainScreen().bounds.width, 44)
......
......@@ -273,7 +273,7 @@ public class TextField : UITextField {
A property that sets the distance between the textField and
titleLabel.
*/
public var titleLabelAnimationDistance: CGFloat = 4
public var titleLabelAnimationDistance: CGFloat = 8
/// An override to the text property.
public override var text: String? {
......@@ -311,7 +311,7 @@ public class TextField : UITextField {
A property that sets the distance between the textField and
detailLabel.
*/
public var detailLabelAnimationDistance: CGFloat = 4
public var detailLabelAnimationDistance: CGFloat = 8
/**
:name: detailLabelHidden
......@@ -334,9 +334,6 @@ public class TextField : UITextField {
}
}
/// A multiplier for the titleLabel and detailLabel frame height.
public private(set) var scale: CGFloat = 2
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
......@@ -528,7 +525,7 @@ public class TextField : UITextField {
v.text = s
}
}
let h: CGFloat = v.font.pointSize * scale
let h: CGFloat = ceil(v.font.lineHeight)
v.frame = CGRectMake(0, -h, bounds.width, h)
v.hidden = false
UIView.animateWithDuration(0.25, animations: { [unowned self] in
......@@ -555,7 +552,7 @@ public class TextField : UITextField {
private func showDetailLabel() {
if let v: UILabel = detailLabel {
if v.hidden {
let h: CGFloat = v.font.pointSize * scale
let h: CGFloat = ceil(v.font.lineHeight)
v.frame = CGRectMake(0, bounds.height + bottomBorderLayerDistance, bounds.width, h)
v.hidden = false
UIView.animateWithDuration(0.25, animations: { [unowned self] in
......
......@@ -263,7 +263,7 @@ public class TextView: UITextView {
A property that sets the distance between the textView and
titleLabel.
*/
public var titleLabelAnimationDistance: CGFloat = 4
public var titleLabelAnimationDistance: CGFloat = 8
/// Placeholder UILabel view.
public var placeholderLabel: UILabel? {
......@@ -303,9 +303,6 @@ public class TextView: UITextView {
}
}
/// A multiplier for the titleLabel and detailLabel frame height.
public private(set) var scale: CGFloat = 2
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
......@@ -511,7 +508,7 @@ public class TextView: UITextView {
v.text = s
}
}
let h: CGFloat = v.font.pointSize * scale
let h: CGFloat = ceil(v.font.lineHeight)
v.frame = CGRectMake(0, -h, bounds.width, h)
v.hidden = false
UIView.animateWithDuration(0.25, animations: { [unowned 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