2011-06-07 62 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