开发者

iOS iPhone ZBar get scanned image

How can I get ZBar to not only return me a barcode text string but a UIImage of scanned ba开发者_JAVA百科rcode as well?


Include something like this in the class that implements 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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜