UITextField

class UITextField : UIControl, UITextInput, NSCoding, UIContentSizeCategoryAdjusting

This extesion adds some useful functions to UITextField.

  • Create an UITextField and set some parameters.

    Declaration

    Swift

    public convenience init(frame: CGRect, placeholder: String, font: UIFont, textColor: UIColor, returnKeyType: UIReturnKeyType, keyboardType: UIKeyboardType, secure: Bool, borderStyle: UITextField.BorderStyle, autocapitalizationType: UITextAutocapitalizationType, keyboardAppearance: UIKeyboardAppearance, enablesReturnKeyAutomatically: Bool, clearButtonMode: UITextField.ViewMode, autocorrectionType: UITextAutocorrectionType, delegate: UITextFieldDelegate?)

    Parameters

    frame

    TextField frame.

    placeholder

    TextField text placeholder.

    font

    TextField text font.

    textColor

    TextField text color.

    returnKeyType

    TextField return key type.

    keyboardType

    TextField keyboard type.

    secure

    Set if the TextField is secure or not.

    borderStyle

    TextField border style.

    autocapitalizationType

    TextField text capitalization.

    keyboardAppearance

    TextField keyboard appearence.

    enablesReturnKeyAutomatically

    Set if the TextField has to automatically enables the return key.

    clearButtonMode

    TextField clear button mode.

    autoCorrectionType

    TextField auto correction type.

    delegate

    TextField delegate. Set nil if it has no delegate.

  • Create an UITextField and set some parameters.

    Declaration

    Swift

    public convenience init(frame: CGRect, placeholder: String, font: FontName, fontSize: CGFloat, textColor: UIColor, returnKeyType: UIReturnKeyType, keyboardType: UIKeyboardType, secure: Bool, borderStyle: UITextField.BorderStyle, autocapitalizationType: UITextAutocapitalizationType, keyboardAppearance: UIKeyboardAppearance, enablesReturnKeyAutomatically: Bool, clearButtonMode: UITextField.ViewMode, autocorrectionType: UITextAutocorrectionType, delegate: UITextFieldDelegate?)

    Parameters

    frame

    TextField frame.

    placeholder

    TextField text placeholder.

    font

    TextField text font name.

    fontSize

    TextField text size.

    textColor

    TextField text color.

    returnKeyType

    TextField return key type.

    keyboardType

    TextField keyboard type.

    secure

    Set if the TextField is secure or not.

    borderStyle

    TextField border style.

    autocapitalizationType

    TextField text capitalization.

    keyboardAppearance

    TextField keyboard appearence.

    enablesReturnKeyAutomatically

    Set if the TextField has to automatically enables the return key.

    clearButtonMode

    TextField clear button mode.

    autoCorrectionType

    TextField auto correction type.

    delegate

    TextField delegate. Set nil if it has no delegate.

  • Paste the pasteboard text to UITextField.

    Declaration

    Swift

    public func pasteFromPasteboard()
  • Copy UITextField text to pasteboard.

    Declaration

    Swift

    public func copyToPasteboard()