iOS 读取相册二维码
2017-06-22 11:58
267 查看
iOS读取相册二维码请使用官方的方法.现在开始练习起来.
func beginQRImage(image:UIImage) -> Void {
let detector = CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh]);
let url = URL(fileURLWithPath: Bundle.main.path(forResource: "timg", ofType: "jpeg")!);
let ciImage = CIImage(contentsOf: url);
let feature = detector?.features(in: ciImage!);
for item in feature! {
print("type = \(item.type)");
if let qrFeature = item as? CIQRCodeFeature {
print(qrFeature.messageString);
}
}
}
就这个以方法就可了.
哦哦,忘了说一下,需要导入CoreImage这个库才行哦.
func beginQRImage(image:UIImage) -> Void {
let detector = CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh]);
let url = URL(fileURLWithPath: Bundle.main.path(forResource: "timg", ofType: "jpeg")!);
let ciImage = CIImage(contentsOf: url);
let feature = detector?.features(in: ciImage!);
for item in feature! {
print("type = \(item.type)");
if let qrFeature = item as? CIQRCodeFeature {
print(qrFeature.messageString);
}
}
}
就这个以方法就可了.
哦哦,忘了说一下,需要导入CoreImage这个库才行哦.
相关文章推荐
- iOS 二维码扫面 相册图片二维码读取和二维码的生成
- iOS QRcode识别及相册图片二维码读取识别
- Unity3d 二维码功能(扫码及相册读取,适配ios与android)
- iOS 条码及二维码扫描(从相册中读取条形码/二维码)及扫码过程中遇到的坑
- iOS 7以上原生二维码、条码扫描(ZXingObjC相册读取)
- iOS 7以上原生二维码、条码扫描(ZXingObjC相册读取)
- iOS中 读取相册,调用系统相机 技术分享
- iOS中 读取相册,调用系统相机 技术分享
- 【学习ios之路:UI系列】点击更换头像实现从相册读取照片和拍照两种功能
- ios从系统相册中读取图片
- IOS 对相册图片进行读取、存储到指定文件夹
- iOS开发——高级篇——二维码的生产和读取
- iOS二维码的读取
- 【iOS开发】二维码生成 二维码读取 (带Logo的二维码)
- iOS读取本地相册
- ios 使用ZBar读取条形码和二维码
- ios ZBar识别选中相册的图片二维码
- 在ios上用ZXing读取二维码,从配置到简单demo
- 在使用zbar这个开源库时从相册读取二维码
- ios读取系统相册以及获取图片的名字