suchen

Heim  >  Fragen und Antworten  >  Hauptteil

ios 原生方法如何识别相册图片二维码

如题,请问ios如何通过原生的方法实现,识别相册图片中的二维码?不考虑版本兼容,不适用第三方

PHPzPHPz2893 Tage vor637

Antworte allen(2)Ich werde antworten

  • 迷茫

    迷茫2017-04-17 17:58:33

    搬运工又来了: http://stackoverflow.com/questions/28317071/scan-qrcode-and-barcode-from-camera-and-image-which-picked-from-image-library-in

    qrCodeImageView.image=qrcodeImg
    
    var detector:CIDetector=CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy:CIDetectorAccuracyHigh])
    var decode=""
    var ciImage:CIImage=CIImage(image:qrcodeImg)
    qrCodeLink=""
    
    let features=detector.featuresInImage(ciImage)
    for feature in features as! [CIQRCodeFeature] {
       qrCodeLink += feature.messageString
    }
    
    if qrCodeLink=="" {
        println("nothing")
    }else{
        println("message: \(qrCodeLink)")
    }

    Antwort
    0
  • PHP中文网

    PHP中文网2017-04-17 17:58:33

    https://github.com/wangruocong/RoyQRcode
    可以参考下,纯原生写的。

    Antwort
    0
  • StornierenAntwort