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
  • 相关阅读:
    js MD5加密后的字符串
    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
    归并排序
    C#分解质因数
    C#找出第n到m个素数之间所有之和
    C#打印0到100的素数
    for循环练习
    express总结(一)
    Nodejs总结(一)
    Webpack配置及使用
  • 原文地址:https://www.cnblogs.com/thbbsky/p/4281636.html
Copyright © 2011-2022 走看看