-
-
Save Laeyoung/717002e14dbd97b810569be4ffbf6ed0 to your computer and use it in GitHub Desktop.
Add padding to UITextField - Swift 3.0
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
class CustomSearchTextField: UITextField { | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
} | |
override func textRect(forBounds bounds: CGRect) -> CGRect { | |
return UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0, 15, 0, 15)) | |
} | |
override func editingRect(forBounds bounds: CGRect) -> CGRect { | |
return UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0, 15, 0, 15)) | |
} | |
override func placeholderRect(forBounds bounds: CGRect) -> CGRect { | |
return UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0, 15, 0, 15)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment