码迷,mamicode.com
首页 > 其他好文 > 详细

ZBarSDK扫描二维码

时间:2015-02-09 15:55:22      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

1:如果报引用文件错误的话需要在设置一下:project->Build settings->build active architecture only选项设置为No。Valid Architecture 选项设置为armv7.

#import "ViewController.h"
#import "ZBarSDK.h"


@interface ViewController ()<ZBarReaderDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *myImageView;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;

@end

@implementation ViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
   
    
    
}
- (IBAction)scanBtnClick:(UIButton *)sender
{
    ZBarReaderViewController *reader=[ZBarReaderViewController new];
    reader.readerDelegate=self;
    ZBarImageScanner *scaner=reader.scanner;
    [scaner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0];
    reader.showsZBarControls=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)
    {
        _myImageView.image=[info objectForKey:UIImagePickerControllerOriginalImage];
        [picker dismissViewControllerAnimated:YES completion:nil];
        _descLabel.text=symbol.data;
    }
}
@end

 

ZBarSDK扫描二维码

标签:

原文地址:http://www.cnblogs.com/thbbsky/p/4281636.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!