zoukankan      html  css  js  c++  java
  • ZBarSDK扫描二维码

    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
  • 相关阅读:
    建立适当的索引
    Windows 10Bash命令
    代码生成工具介绍和使用
    分布式的任务调度框架
    Net分布式系统
    Keepalived+LVS+Nginx负载均衡之高可用
    call,apply,bind
    2015搜狐在线笔试题(内存泄露问题)(转)
    十步完全理解SQL(转)
    Linux shell用法和技巧(转)
  • 原文地址:https://www.cnblogs.com/thbbsky/p/4281636.html
Copyright © 2011-2022 走看看