iOS长按识别图中二维码 zbar

iOS真相.gif
点个星星 谢
下载链接 https://github.com/Rempage/Scanf-QR-Code
####基于ZBar####

#pragma mark -------判断是否为二维码
- (void)isPinCodeWithImage:(UIImage *)image{
    ZBarReaderController* read = [ZBarReaderController new];
    CGImageRef cgImageRef = image.CGImage;
    ZBarSymbol* symbol = nil;
    for(symbol in  [read scanImage:cgImageRef])
        break;
    _pincodeURL = symbol.data;
    UIActionSheet *actionSheet;
    if ([symbol.data hasPrefix:@"http"]) {
        actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                  delegate:self
                                         cancelButtonTitle:@"取消"
                                    destructiveButtonTitle:@"保存图片"
                                         otherButtonTitles:@"扫二维码"];
    } else {
        actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                  delegate:self
                                         cancelButtonTitle:@"取消"
                                    destructiveButtonTitle:@"保存图片"
                                         otherButtonTitles:nil];
    }
    [actionSheet showInView:self.superview];
}

下载链接 https://github.com/Rempage/Scanf-QR-Code

你可能感兴趣的:(iOS长按识别图中二维码 zbar)