Commit 6e3438dc by Daniel Dahan

updated TextView to handle lower case characters that extend beyond the frame height

parent 76395176
......@@ -273,7 +273,7 @@ public class TextField : UITextField {
A property that sets the distance between the textField and
titleLabel.
*/
public var titleLabelAnimationDistance: CGFloat = 8
public var titleLabelAnimationDistance: CGFloat = 4
/// 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 = 8
public var detailLabelAnimationDistance: CGFloat = 4
/**
:name: detailLabelHidden
......@@ -335,7 +335,7 @@ public class TextField : UITextField {
}
/// A multiplier for the titleLabel and detailLabel frame height.
public private(set) var scale: CGFloat = UIScreen.mainScreen().scale
public private(set) var scale: CGFloat = 2
/**
An initializer that initializes the object with a NSCoder object.
......@@ -416,12 +416,8 @@ public class TextField : UITextField {
if interrupted.
*/
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
if let b: CABasicAnimation = a as? CABasicAnimation {
layer.setValue(nil == b.toValue ? b.byValue : b.toValue, forKey: b.keyPath!)
}
if anim is CAPropertyAnimation {
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStop?(anim, finished: flag)
layer.removeAnimationForKey(a.keyPath!)
} else if let a: CAAnimationGroup = anim as? CAAnimationGroup {
for x in a.animations! {
animationDidStop(x, finished: true)
......
......@@ -263,7 +263,7 @@ public class TextView: UITextView {
A property that sets the distance between the textView and
titleLabel.
*/
public var titleLabelAnimationDistance: CGFloat = 8
public var titleLabelAnimationDistance: CGFloat = 4
/// Placeholder UILabel view.
public var placeholderLabel: UILabel? {
......@@ -303,6 +303,9 @@ 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.
......@@ -399,12 +402,8 @@ public class TextView: UITextView {
if interrupted.
*/
public override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if let a: CAPropertyAnimation = anim as? CAPropertyAnimation {
if let b: CABasicAnimation = a as? CABasicAnimation {
layer.setValue(nil == b.toValue ? b.byValue : b.toValue, forKey: b.keyPath!)
}
if anim is CAPropertyAnimation {
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStop?(anim, finished: flag)
layer.removeAnimationForKey(a.keyPath!)
} else if let a: CAAnimationGroup = anim as? CAAnimationGroup {
for x in a.animations! {
animationDidStop(x, finished: true)
......@@ -512,7 +511,7 @@ public class TextView: UITextView {
v.text = s
}
}
let h: CGFloat = v.font.pointSize
let h: CGFloat = v.font.pointSize * scale
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