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];}