// 1.创建扫描器
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:nil];
// 2.扫描结果
CIImage *ciImage = [[CIImage alloc] initWithImage:image];
NSArray *features = [detector featuresInImage:ciImage];
// 3.遍历扫描结果
for (CIQRCodeFeature *f in features) {
// 如果是网址就跳转
if ([f.messageString containsString:@"http://"] || [f.messageString containsString:@"https://"] ) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:f.messageString]];
}else{ // 其他信息 弹框显示
[self showHint:f.messageString];
}
}
//保存图片
UIImageWriteToSavedPhotosAlbum(_quarCodeImageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);