Commit 47afc002 by Daniel Dahan

development: fixed TextField textInset for adjusted bounds

parent 2e262c5a
...@@ -382,8 +382,7 @@ open class TextField: UITextField { ...@@ -382,8 +382,7 @@ open class TextField: UITextField {
} }
open override func becomeFirstResponder() -> Bool { open override func becomeFirstResponder() -> Bool {
setNeedsLayout() layoutSubviews()
layoutIfNeeded()
return super.becomeFirstResponder() return super.becomeFirstResponder()
} }
...@@ -391,7 +390,10 @@ open class TextField: UITextField { ...@@ -391,7 +390,10 @@ open class TextField: UITextField {
open var textInset: CGFloat = 0 open var textInset: CGFloat = 0
open override func textRect(forBounds bounds: CGRect) -> CGRect { open override func textRect(forBounds bounds: CGRect) -> CGRect {
return bounds.insetBy(dx: textInset, dy: 0) var b = super.textRect(forBounds: bounds)
b.origin.x += textInset
b.size.width -= textInset
return b
} }
open override func editingRect(forBounds bounds: CGRect) -> CGRect { open override func editingRect(forBounds bounds: CGRect) -> CGRect {
......
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