Skip to content

Latest commit

 

History

History
34 lines (31 loc) · 1.08 KB

README.md

File metadata and controls

34 lines (31 loc) · 1.08 KB

WMPasswordView

Swift4.2 仿微信、支付宝输入支付密码

效果展示

Usage

把WMPasswordView文件夹拖入项目中, 代码如下:

class ViewController: UIViewController {
    @IBOutlet weak var payPwdLabel: UILabel!
    /// lazy load
    lazy var payPasswordView: WMPasswordView = {
        let pwdView = WMPasswordView(type: WMPwdType.payPwd, amount: 250.0)
        /// 回调 closure 可以在本类任意方法类写
        pwdView.completed = { [weak self] pwd in
            self?.payPwdLabel?.text = "输入的密码:" + pwd
        }
        return pwdView
    }()
    /// 类方法调用
    @IBAction func classFunction() {
        WMPasswordView.show(type: WMPwdType.payPwd, amount: 1200.0) { [weak self] pwd in
            self?.payPwdLabel?.text = "输入的密码:" + pwd
        }
    }
    /// 实例方法调用
    @IBAction func instanceFunction() {
        payPasswordView.show()
    }
}

如果对您有帮助,请给个Star!😄,Thank you for look!