Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ann-iOS opened this issue Nov 3, 2021 · 1 comment
Open

Comments

@Ann-iOS
Copy link

Ann-iOS commented Nov 3, 2021

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 库后都需要重新进行设置, 是否可以进行优化?

@keleboys
Copy link

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

    }

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants