2011-06-07 63 views

回答

4

包括在實現ZBarReaderDelegate類是這樣的:

- (void) imagePickerController: (UIImagePickerController*) reader 
didFinishPickingMediaWithInfo: (NSDictionary*) info 
{ 
    // ADD: get the decode results 
    id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults]; 
    ZBarSymbol* symbol = nil; 

    for (symbol in results) 
    { 
     // grab first barcode 
     break; 
    } 

    // do something with barcode data 
    qrCode.text = symbol.data; 

    // do something with barcode image 
    // BELOW IS HOW YOU GET THE SCANNED IN IMAGE 
    // 
    resultImage.image = [info objectForKey: UIImagePickerControllerOriginalImage]; 

    // dismiss controller 
    [reader dismissModalViewControllerAnimated: YES]; 
+0

此委託方法沒有得到所謂的在我的代碼任何幫助嗎? – Nil 2012-12-29 06:18:39

+0

[infoObjectForKey:UIImagePickerControllerOriginalImage]返回相機捕獲的完整圖像。但是,如何單獨獲取條形碼圖標? – Bharathi 2013-06-21 06:15:45