iphone 使用ZBar 条码扫描

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/zl19870208/article/details/84042410
1. 下载ZBarSDK 添加到工程
2. 添加需要的framework
3. #import "ZBarSDK.h" 添加协议 ZBarReaderDelegate
4.

ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
ZBarImageScanner *scanner = reader.scanner;
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
[self presentModalViewController: reader
animated: YES];
[reader release];


- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
id<NSFastEnumeration> results =
[info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results)
break;
NSLog(@"===%@",symbol.data);

self.tfOrderNumber.text = symbol.data;

[reader dismissModalViewControllerAnimated: YES];
}


展开阅读全文

没有更多推荐了,返回首页