ZBarSDKスキャンQRコード

2877 ワード

1:レポート参照ファイルが間違っている場合は、project->Build settings->build active architecture onlyオプションをNoに設定する必要があります.Valid Architectureオプションはarmv 7に設定.
#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