CustomUITextField
class CustomUITextField: GeneralUITextField
This class was designed to allow the programmer to insert an imageView on the left side of a GeneralUITextField
-
This variable is the leftImage itself. When it is set, or changed, it calles
updateView.Declaration
Swift
@IBInspectable var leftImage: UIImage? -
This
CGFloatrepresents the padding between theUIImageViewand the text.Declaration
Swift
@IBInspectable var leftPadding: CGFloat = 0 -
This
CGFloatrepresents the width of theUIImageView.Declaration
Swift
@IBInspectable var imageWidth: CGFloat = 20 -
Tint color for the
UIImageView. When this is set,updateViewis called. note - in order for the image to visually change tintColor, it’sRender as
property in Assets.xcassets must be set toTemplate Image
.Declaration
Swift
@IBInspectable var color: UIColor = UIColor.WHITE
-
This function moves the textField x-origin component of UITextField by
leftPadding.Declaration
Swift
override func leftViewRect(forBounds bounds: CGRect) -> CGRect -
This method is overridden to set
leftViewModetoUITextFieldViewMode.always.Declaration
Swift
override func awakeFromNib() -
This function updates all of the views within the
UITextFieldobject. It creates insets for the UIImage provided inleftImagethen sets the imageView as well as it’s properties such as thetintColorandcontentMode.Declaration
Swift
func updateView()
View on GitHub
CustomUITextField Class Reference