当前位置: 代码迷 >> Iphone >> iphone 运用ZBar 条码扫描
  详细解决方案

iphone 运用ZBar 条码扫描

热度:91   发布时间:2016-04-25 06:35:51.0
iphone 使用ZBar 条码扫描
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];}
  相关解决方案