Created
April 10, 2021 05:59
-
-
Save janeshsutharios/1a60b0510871277d5a5841181c75aaea to your computer and use it in GitHub Desktop.
PaddingUItextField.swift
This file contains 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 PaddingTextField: UITextField { | |
let padding = UIEdgeInsets(top: 4, left: 8, bottom: 4, right: 8) | |
override open func textRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.inset(by: padding) | |
} | |
override open func placeholderRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.inset(by: padding) | |
} | |
override open 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