UIImageView*tempImageView=(UIImageView*)gesture.view;
if(tempImageView.image){
//1. 初始化扫描仪,设置设别类型和识别质量
CIDetector*detector = [CIDetectordetectorOfType:CIDetectorTypeQRCodecontext:niloptions:@{CIDetectorAccuracy : CIDetectorAccuracyHigh}];
//2. 扫描获取的特征组
NSArray *features = [detector featuresInImage:[CIImage imageWithCGImage:tempImageView.image.CGImage]];
//3. 获取扫描结果
CIQRCodeFeature *feature = [featuresobjectAtIndex:0];
NSString *scannedResult = feature.messageString;
UIAlertView * alertView = [[UIAlertViewalloc]initWithTitle:@"扫描结果"message:scannedResult delegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil,nil];
[alertView show];
}else {
UIAlertView * alertView = [[UIAlertViewalloc]initWithTitle:@"扫描结果"message:@"您还没有生成二维码"delegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil,nil];
[alertView show];
}