【发布时间】:2023-03-15 03:05:01
【问题描述】:
我在 OTP 字段中使用 VPMOTPView,当我在此处点击 OTP 视图时,我正在获取带数字键盘的键盘,但在这里如何将完成按钮添加到键盘。
我可以在键盘上为文本字段添加完成按钮,但如何为 VPMOTPView 添加。
class OTPViewController: UIViewController {
@IBOutlet weak var otpView: VPMOTPView!
var phone : String?
var otp : String?
override func viewDidLoad() {
super.viewDidLoad()
//self.navigationBarButton()
otpView.otpFieldsCount = 6
otpView.otpFieldDefaultBorderColor = UIColor.lightGray
otpView.otpFieldEnteredBorderColor = UIColor(named: "LightPrimaryColor") ?? UIColor.blue
otpView.otpFieldErrorBorderColor = UIColor.red
otpView.otpFieldBorderWidth = 1
otpView.delegate = self
otpView.shouldAllowIntermediateEditing = false
otpView.otpFieldSize = 25
otpView.otpFieldDisplayType = .underlinedBottom
otpView.otpFieldEntrySecureType=false
otpView.initializeUI()
emailIconLabel.text = "We have sent an sms with OTP \nto \(phone!)"
self.getOTPService()
}
}
请帮助我在键盘上添加完成的代码。
【问题讨论】:
-
添加第三方库 pod 'IQKeyboardManagerSwift',完成按钮就会出现。提前致谢。
-
乐于助人为你加油