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 CGFloat represents the padding between the UIImageView and the text.

    Declaration

    Swift

    @IBInspectable var leftPadding: CGFloat = 0
  • This CGFloat represents the width of the UIImageView.

    Declaration

    Swift

    @IBInspectable var imageWidth: CGFloat = 20
  • Tint color for the UIImageView. When this is set, updateView is called. note - in order for the image to visually change tintColor, it’s Render as property in Assets.xcassets must be set to Template 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 leftViewMode to UITextFieldViewMode.always.

    Declaration

    Swift

    override func awakeFromNib()
  • This function updates all of the views within the UITextField object. It creates insets for the UIImage provided in leftImage then sets the imageView as well as it’s properties such as the tintColor and contentMode.

    Declaration

    Swift

    func updateView()