ZBar之ZBarReaderViewController
//
// ViewController.m
// ZBarReaderViewController
//
// Created by City--Online on 15/6/9.
// Copyright (c) 2015年 CYW. All rights reserved.
//
#import "ViewController.h"
#import "ZBarSDK.h"
@interface ViewController ()<ZBarReaderDelegate>
@property(nonatomic,strong) UIImageView *imgView;
@property(nonatomic,strong) UILabel *label;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:@"扫你" forState:UIControlStateNormal];
[btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
btn.frame=CGRectMake(, , , );
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
_imgView=[[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
[self.view addSubview:_imgView];
_label=[[UILabel alloc]initWithFrame:CGRectMake(, , , )];
[_label setTextColor:[UIColor redColor]];
[self.view addSubview:_label];
}
-(void)btnClick:(id)sender
{
ZBarReaderViewController *reader=[[ZBarReaderViewController alloc]init];
reader.readerDelegate=self;
ZBarImageScanner *scanner=reader.scanner;
[scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:];
reader.showsZBarControls=YES;
reader.showsHelpOnFail=NO;
// reader.showsCameraControls=YES;
[self presentViewController:reader animated:YES completion:nil];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
id<NSFastEnumeration> results = [info objectForKey:ZBarReaderControllerResults];
ZBarSymbol * symbol;
for(symbol in results)
break;
_imgView.image = [info objectForKey:UIImagePickerControllerOriginalImage];
[picker dismissViewControllerAnimated:YES completion:nil];
_label.text = symbol.data;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end


ZBar之ZBarReaderViewController的更多相关文章
- iphone 开发中使用zbar时遇到的几个典型问题解决方法。
iphone 开发中使用zbar时遇到的几个典型问题解决方法. 在近期的一个ios项目中使用到了一个二维码扫描库(Qrcode)--ZBar, 期间遇到2个问题. 1. zbar下载后使用其l ...
- ZBar与ZXing使用后感觉
[原]ZBar与ZXing使用后感觉(上) 2014-3-18阅读2011 评论1 最近对二维码比较感兴趣,还是那句老话,那么我就对比了一下zxing和zbar 如果对于这两个的背景不了解的话,可以看 ...
- 二维码ZBar之ZBarReaderView
参考:http://www.chinatarena.com/Html/iospeixun/201301/3985.html http://blog.csdn.net/chenyong05314/a ...
- 在iOS中使用ZBar扫描二维码
最近在做的项目中需要用到二维码扫描功能,之前在Android中使用过ZXing识别二维码,ZXing也有对应的iOS版本,经过了解,ZBar也是一个常用的二维码识别软件,并分别提供了iOS和Andro ...
- ZBar的简单使用
NSRunLoop类声明的编程接口用于管理输入源对象.一个NSRunLoop对象处理像来自窗体系统中的鼠标和键盘事件,NSPORT对象和NSConnection连接对象这类的输入源.一个NSRunLo ...
- iOS 二维码扫描 通过ZBar ZXing等第三方库
扫描二维码的开源库有很多如 ZBar.ZXing等 ZBar的使用方法: 下载ZBar SDK 地址https://github.com/bmorton/ZBarSDK ZBarSDK是一个开源的SD ...
- iOS-条形码扫描技术SDK:ZBar(转)
ios条形码扫描技术 iOS 应用里实现条形码扫描功能,有个免费开源的 SDK:ZBar(http://zbar.sourceforge.net/iphone/sdkdoc/install.html) ...
- 在iOS中使用ZBar扫描二维码和条形码
最近做了个外包项目,里面用到了二维码扫描和微信支付!之前比较熟悉的是ZXing,但是在Xcode7.1里面发现竟然莫名的不支持,木有办法,从网上查了一下还有一种支持二维码扫描的东西,没错就是接下来我要 ...
- C#使用zxing,zbar,thoughtworkQRcode解析二维码,附源代码
最近做项目需要解析二维码图片,找了一大圈,发现没有人去整理下开源的几个库案例,花了点时间 做了zxing,zbar和thoughtworkqrcode解析二维码案例,希望大家有帮助. zxing是谷歌 ...
随机推荐
- 利用HttpWebRequest模拟表单提交
using System; using System.Collections.Specialized; using System.IO; using System.Net; using System. ...
- leetcode 最后一个单词的长度
给定一个仅包含大小写字母和空格 ' ' 的字符串,返回其最后一个单词的长度. 如果不存在最后一个单词,请返回 0 . 说明:一个单词是指由字母组成,但不包含任何空格的字符串. 示例: 输入: &quo ...
- ASP.NET Core 装X利器SignalR:电子画板
电子画板开发需求 教师端需求: 教师登录后能创建房间(教室) 学生加入房间后有通知提醒 教师能够解散房间 基本的画板功能 学生端需求: 能够切换不同在线的房间 能够收到新建房间的通知 能够收到房间 ...
- WPF Item拖拽 DragDrop
今天有个需求是需要拖拽DataGrid中的item到另一个DataGrid.自己实现还比较繁琐,网上查了查,发现一个不错的开源项目 gong-wpf-dragdrop nuget安装下:Install ...
- sql表与表之间的数据操作
--把一张表的内容更新到另一张表 update 表1 set 表1.Store=t2.Name from 表2 t2 where 表1.id=t2.id --备份一张表 create table ta ...
- westrac server security configure user info
security userkey:westracpass:Set#@!123
- 【文文殿下】ExBSGS
无需逆元版本: #include<cstdio> #include<cassert> #include<cmath> #include<map> typ ...
- sublime-text-how-to-jump-to-file-from-find-results-using-keyboard
http://209.116.186.231/#newwindow=1&q=sublime+text+find+results+jump http://stackoverflow.com/qu ...
- tomcat apr Dockfile
基于 centos7.4 jdk1.7 RUN yum makecache && yum --nogpgcheck -y groupinstall 'Development Tools ...
- 更换SSL证书
1.申请证书,需要提供完整域名(例如:xxx.aaa.com),会和证书完全匹配. 2.将证书上传到web服务器,例如我的nginx,在server中指定证书路径. 3.重启web服务器.(这个证书和 ...