PasscodeView

@MainActor
open class PasscodeView : UIView, UICollectionViewDataSource, UICollectionViewDelegate, UITextFieldDelegate

PasscodeView

CRBoxInputView

Accessor

  • 是否需要光标,默认: YES

    Declaration

    Swift

    @MainActor
    open var showCursor: Bool
  • 验证码长度,默认: 4

    Declaration

    Swift

    @MainActor
    open private(set) var codeLength: Int { get set }
  • 是否开启密文模式,默认: NO,描述:你可以在任何时候修改该属性,并且已经存在的文字会自动刷新

    Declaration

    Swift

    @MainActor
    open var needSecurity: Bool { get set }
  • 显示密文的延时时间,默认0防止录屏时录下明文

    Declaration

    Swift

    @MainActor
    open var securityDelay: TimeInterval
  • 键盘类型,默认: UIKeyboardTypeNumberPad

    Declaration

    Swift

    @MainActor
    open var keyboardType: UIKeyboardType { get set }
  • 输入样式,默认: PasscodeInputTypeNumber

    Declaration

    Swift

    @MainActor
    open var inputType: PasscodeInputType
  • 自定义正则匹配输入内容,默认: “",当inputType == PasscodeInputTypeRegex时才会生效

    Declaration

    Swift

    @MainActor
    open var customInputRegex: String?
  • textContentType,描述: 你可以设置为 ‘nil’ 或者 ‘UITextContentTypeOneTimeCode’ 来自动获取短信验证码,默认: nil

    Declaration

    Swift

    @MainActor
    open var textContentType: UITextContentType? { get set }
  • 占位字符填充值,在对应的输入框没有内容时,会显示该值。默认:nil

    Declaration

    Swift

    @MainActor
    open var placeholderText: String?
  • 弹出键盘时,是否清空所有输入,只有在输入的字数等于codeLength时,生效。默认: NO

    Declaration

    Swift

    @MainActor
    open var clearAllWhenEditingBegin: Bool
  • 输入完成时,是否自动结束编辑模式,收起键盘。默认: YES

    Declaration

    Swift

    @MainActor
    open var endEditWhenEditingFinished: Bool
  • Undocumented

    Declaration

    Swift

    @MainActor
    open var textDidChangeBlock: ((_ text: String, _ isFinished: Bool) -> Void)?
  • Undocumented

    Declaration

    Swift

    @MainActor
    open var editStatusChangeBlock: ((PasscodeEditStatus) -> Void)?
  • Undocumented

    Declaration

    Swift

    @MainActor
    open var customCellBlock: ((PasscodeView, IndexPath) -> UICollectionViewCell)?
  • Undocumented

    Declaration

    Swift

    @MainActor
    open lazy var collectionView: UICollectionView { get set }
  • Undocumented

    Declaration

    Swift

    @MainActor
    open lazy var flowLayout: PasscodeFlowLayout { get set }
  • Undocumented

    Declaration

    Swift

    @MainActor
    open var cellProperty: PasscodeCellProperty
  • Undocumented

    Declaration

    Swift

    @MainActor
    open var textValue: String { get }
  • Undocumented

    Declaration

    Swift

    @MainActor
    open var textAccessoryView: UIView? { get set }

Lifecycle

  • Undocumented

    Declaration

    Swift

    @MainActor
    override public init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

    @MainActor
    public required init?(coder: NSCoder)
  • Undocumented

    Declaration

    Swift

    @MainActor
    public init(codeLength: Int)

Public

  • 装载数据和准备界面,beginEdit: 自动开启编辑模式。默认: YES

    Declaration

    Swift

    @MainActor
    open func prepareView(beginEdit: Bool = true)
  • 重载输入的数据(用来设置预设数据)

    Declaration

    Swift

    @MainActor
    open func reloadInputString(_ value: String?)
  • 开始编辑模式

    Declaration

    Swift

    @MainActor
    open func beginEdit()
  • 结束编辑模式

    Declaration

    Swift

    @MainActor
    open func endEdit()
  • 清空输入,beginEdit: 自动开启编辑模式。默认: YES

    Declaration

    Swift

    @MainActor
    open func clearAll(beginEdit: Bool = true)
  • 快速设置

    Declaration

    Swift

    @MainActor
    open func setSecuritySymbol(_ securitySymbol: String)
  • 调整codeLength

    Declaration

    Swift

    @MainActor
    open func resetCodeLength(_ codeLength: Int, beginEdit: Bool = true)

UICollectionView

  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

UITextFieldDelegate