iphone 使用ZBar 条码扫描

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


阅读更多
文章标签: iphone
个人分类: Iphone应用开发
上一篇CABasicAnimation animationWithKeyPath 一些规定的值
下一篇使用XCode调试
想对作者说点什么? 我来说一句

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

关闭
关闭