[置顶] 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 多多支持
#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 多多支持
相关文章推荐
- 根据ios或者安卓扫描二维码进行相应下载
- iOS学习之——一些常见的数据类型的转换
- IOS9需要升级提升的点
- iOS开发规范文档
- iOS开发-做项目中遇到的坑
- iOS 左右两列按钮之间进行连线
- iOS远程推送原理及实现过程
- IOS后台运行机制详解(二)
- GitHub 排名前 100 的安卓、iOS项目简介
- IOS后台运行机制详解(一)
- iOS数据持久化文件读写之偏好设置
- iOS IM开发建议(三)添加一个自定义键盘
- iOS Video Streaming(收集,整理)
- 基于iOS 的 VLC简单 Demo
- ios 8新特性
- iOS 摇一摇功能
- iOS开发学习路径的一些建议
- Vickate_iOS视图控制器的生命周期,统计的很全面
- ios中的字符串等的拼接+for循环实例
- iOS中版本号的获取及其意义