iphone 使用ZBar 条码扫描
.1. 下载ZBarSDK 添加到工程
2. 添加需要的framework
3. #import "ZBarSDK.h" 添加协议 ZBarReaderDelegate
4.
Java代码
1.ZBarReaderViewController *reader = [ZBarReaderViewController new];
2. reader.readerDelegate = self;
3. ZBarImageScanner *scanner = reader.scanner;
4. [scanner setSymbology: ZBAR_I25
5. config: ZBAR_CFG_ENABLE
6. to: 0];
7. [self presentModalViewController: reader
8. animated: YES];
9. [reader release];
10.
11.
12.- (void) imagePickerController: (UIImagePickerController*) reader
13. didFinishPickingMediaWithInfo: (NSDictionary*) info
14.{
15. id<NSFastEnumeration> results =
16. [info objectForKey: ZBarReaderControllerResults];
17. ZBarSymbol *symbol = nil;
18. for(symbol in results)
19. break;
20. NSLog(@"===%@",symbol.data);
21.
22. self.tfOrderNumber.text = symbol.data;
23.
24. [reader dismissModalViewControllerAnimated: YES];
25.}