Last active
June 11, 2019 12:19
-
-
Save sunnyleeyun/6bf8f11d50789f741c99f2ea858acffd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class UITextFieldPadding : UITextField { | |
let padding = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
} | |
override func textRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.inset(by: padding) | |
} | |
override func placeholderRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.inset(by: padding) | |
} | |
override func editingRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.inset(by: padding) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment