2013-02-12 26 views
-1

我想將Zbarsdk包含在我現有的應用程序中......我發現readertest示例真的是一個很好的示例,因爲它包含所有功能和選項,但該示例僅包含名爲「 reader test.m「,裏面嵌入了AppDelegate ...它沒有xib,因爲所有的初始化都是以編程方式進行的...所以我怎麼才能將它添加到我的應用程序中,該應用程序可以掃描代碼?將ZBarSdk readertest示例整合到現有的應用程序

回答

0

導入ZBarSDK文件夾,它應該有一個libzbar.a庫和頭文件和資源文件。

現在使用ZBarReaderDelegate進口「ZBarReaderController.h」文件之後,使用以下功能:

-(IBAction) scan 
    {  
     NSLog(@" SCAN BARCODE BUTTON TAPPED "); 
     ZBarReaderViewController *reader = [ZBarReaderViewController new]; 
     reader.readerDelegate = self; 
     reader.showsHelpOnFail = YES; 

     ZBarImageScanner *scanner = reader.scanner; 
     [scanner setSymbology: ZBAR_I25 
         config: ZBAR_CFG_ENABLE 
          to: 0]; 

     [self presentModalViewController:reader animated:YES]; 
    } 

- (void) imagePickerController: (UIImagePickerController*) reader 
didFinishPickingMediaWithInfo: (NSDictionary*) info 
{ 
    id<NSFastEnumeration> results = info[ZBarReaderControllerResults]; 
    ZBarSymbol *symbol = nil; 
    for(symbol in results) 
     break; 
    NSString *EANCode = symbol.data; 

    [reader dismissModalViewControllerAnimated: YES]; 

    // so you have got the EAN code as result use it in your app 
} 
+0

@Bhupendra ....我想我的觀點看起來很相像ZBarSdk的讀者測試例...有你檢查了它? – Saty 2013-02-12 10:21:46

+0

這種類型的正常例子,我嘗試和實現... – Saty 2013-02-12 10:22:09

+0

那麼你還想做什麼? – Bhupendra 2013-02-12 10:23:56

相關問題