Last active
December 17, 2018 15:39
-
-
Save lawreyios/5d13bc80d999634e37401e3bc3e5bd23 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 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
@lawreyios It doesn't work on edit mode. Can you merge this forked gist (https://gist.github.com/Laeyoung/717002e14dbd97b810569be4ffbf6ed0)