ZBar にバーコードのテキスト文字列だけでなく、スキャンしたバーコードの UIImage も返してもらうにはどうすればよいですか?
1771 次
1 に答える
3
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];
于 2011-06-13T02:50:21.853 に答える