CRBoxInputView icon indicating copy to clipboard operation
CRBoxInputView copied to clipboard

在Swift中使用时, 初始化 CRBoxInputCellProperty 无作用

Open Ann-iOS opened this issue 2 years ago • 1 comments

lazy var boxView : CRBoxInputView = { let view = CRBoxInputView.init(codeLength: 6) // let cellProperty = CRBoxInputCellProperty() // cellProperty.cellBorderColorNormal = .clear // cellProperty.cellBorderColorSelected = .colorWithHexString(ThemeMainColor) // cellProperty.cellBorderColorFilled = .clear // cellProperty.cellBgColorNormal = .colorWithHexString(ThemeBlockColor) // cellProperty.cellBgColorSelected = .colorWithHexString(ThemeBlockColor) // cellProperty.cellBgColorFilled = .colorWithHexString(ThemeMainColor) // cellProperty.cellCursorColor = .colorWithHexString(ThemeMainColor) // cellProperty.borderWidth = 1 // cellProperty.cornerRadius = 20 // cellProperty.configCellShadowBlock = { [weak self] (layer: CALayer) in // layer.shadowColor = UIColor.colorWithHexString(ThemeBlockColor, alpha: 0.2).cgColor // layer.shadowOpacity = 1 // layer.shadowOffset = CGSize(width: 0, height: 2) // layer.shadowRadius = 10 // } // ^[A-Za-z0-9]+$ view!.keyBoardType = .asciiCapable view!.inputType = .regex view!.customInputRegex = "[^A-Za-z0-9]" view!.boxFlowLayout?.itemSize = CGSize(width: 44, height: 50) view!.loadAndPrepare(withBeginEdit:false) // view!.customCellProperty = cellProperty return view! }() 按照以上设置, CRBoxInputCellProperty 完全不起作用, 只能修改库中的源代码, 但是每次更新pod 库后都需要重新进行设置, 是否可以进行优化?

Ann-iOS avatar Nov 03 '21 03:11 Ann-iOS

let tf = CRBoxInputView() tf.boxFlowLayout?.itemSize = CGSize(width: 60, height: 60) tf.customCellProperty = cellProperty tf.textDidChangeblock = { (text, isFinished) in

    }

tf.loadAndPrepare(withBeginEdit: true) 这样子可以初步解决cellProperty不起作用的问题,建议作者可以在属性设置成功后刷新一下相关属性

keleboys avatar Jun 20 '22 03:06 keleboys