iosobjective-ccocoa-touchzbar-sdk

ZBAR read static UIImage (No Camera preview)


Im building an application for IPad and I am using ZBar.

The image containing the barcode data is a UIImage called TempUIImage. How can I use ZBar to detect the value of the barcode and it's location.

Note: I don't want want the camera preview at all as the TempUIImage is an UIImage that should be taken from another application.


Solution

  • You can use ZBarImageScanner class. Here there is a complete documentation ZBarImageScanner

    Here there is an example on how to use it (I don't tested it on device):

    ZBarImageScanner *scanner = [[ZBarImageScanner alloc]init];
    NSInteger resultsnumber = [scanner scanImage:yourUIImage];
    if(resultsnumber > 0){
        ZBarSymbolSet *results = scanner.results;
        //do whatever u want with results!!!
    }