您的位置:首页 > 移动开发 > IOS开发

[置顶] iOS长按识别图中二维码

2016-05-20 11:05 302 查看
直接上代码  基于 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:@"扫二维码", nil];
} else {
actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"保存图片" otherButtonTitles:nil, nil];
}
[actionSheet showInView:self.superview];
}
出来 CSDN  多多支持
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: