-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hello @posix88 i am new to swift and ios. I want to implement this otp text field in my verfication view controller programatically. Do you have any example for this it will be help ful.
Following code i have tried
`
lazy var newVerification: VerificationCodeView = {
let vv = VerificationCodeView()
vv.translatesAutoresizingMaskIntoConstraints = false
vv.setLabelNumber(6)
vv.delegate = self
vv.labelHasBorder = true
vv.borderHeigth = 1
vv.labelBorderColor = UIColor.black
vv.labelErrorColor = UIColor.red
vv.labelTextColor = UIColor.black
//vv.labelBackgroundColor =
vv.labelWidth = 24
vv.isNumeric = true
vv.labelSpacing = 16
return vv
}()
func setupCode(){
view.addSubview(newVerification)
newVerification.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
newVerification.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
if #available(iOS 11.0, *) {
newVerification.topAnchor.constraint(equalTo: view.topAnchor,constant: 50).isActive = true
} else {
// Fallback on earlier versions
}
newVerification.heightAnchor.constraint(equalToConstant: 80).isActive = true
}`
tnmendes
Metadata
Metadata
Assignees
Labels
No labels