2013-05-21 23 views
1

我使用Zxing庫進行條碼,QR碼和數據矩陣掃描。掃描過程工作正常。如何獲得zxing庫的條碼類型和格式

我也從ZXingWidgetController的didScanResult委託方法中得到結果字符串。

- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result { 
} 

但我有一個問題...

如何得到(文字,網址,地址簿,電話號碼,電子郵件地址等)和格式(QR碼,數據矩陣或條形碼)結果

請幫助...

提前

和感謝...

+0

的格式:http://stackoverflow.com/questions/4932367/how-to-obtain-scanned-barcode-type-with-zxing-library?rq=1 – peko

+0

@peko這個答案是不妥當的也沒有工作。我已經看到這個,也沒有被接受.... – DharaParekh

回答

2

假設你目前正在使用ZXingWidget吧? 由於無法在此庫中獲取條形碼格式。所以我所做的是我用ZXingObjC庫替換了這個庫以獲得條碼類型以及格式。

-(void)captureResult:(ZXCapture *)capture result:(ZXResult *)result 
{ 
    if (!result) return; 
    // We got a result. Display information about the result onscreen. 
    NSString *formatString = [self barcodeFormatToString:result.barcodeFormat]; 
    NSString *display = [NSString stringWithFormat:@"Scanned!\n\nFormat: 
    %@\n\nContents:\n%@", formatString, result.text]; 
}