关闭

iphone 使用ZBar 条码扫描

1774人阅读 评论(0) 收藏 举报

http://zl4393753.iteye.com/blog/1184919

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


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:336288次
    • 积分:3212
    • 等级:
    • 排名:第14357名
    • 原创:18篇
    • 转载:66篇
    • 译文:0篇
    • 评论:18条
    最新评论