如何使用多个文本框生成QR代码

时间:2019-05-04 12:16:27

标签: swift

@IBAction func personalInfoButtonPressed(_ sender: UIButton) {
    if let mystring = firstTextField!.text {
        let qrCode = mystring.data(using: .ascii)
        let filter = CIFilter(name: "CIQRCodeGenerator")
        filter?.setValue(qrCode, forKey: "inputMessage")
        let img = UIImage(ciImage: (filter?.outputImage)!)
        personalInfoImageView.image = img
    }
}

0 个答案:

没有答案