我正在爲Iphone和Ipad開發QR碼閱讀器。我正在使用ZBar庫來讀取qr碼。但是當我專注於任何二維碼時,應用程序什麼都不做。我正在使用在文檔部分的zbar網站上給出的代碼。這裏是我的代碼:ZBar qrcode庫不適用於IOS
ZBarReaderViewController *barReader = [ZBarReaderViewController new];
barReader.readerDelegate = self;
[barReader.scanner setSymbology:ZBAR_QRCODE config:ZBAR_CFG_ENABLE to:0];
barReader.readerView.zoom = 1.0;
barReader.showsCameraControls = NO;
barReader.showsZBarControls = NO;
barReader.wantsFullScreenLayout = NO;
barReader.title = @"QRCode Reader";
[self presentModalViewController:barReader animated:YES];
而且在
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
功能我正在檢索這樣
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
ZBarSymbolSet *symbols = [info objectForKey:ZBarReaderControllerResults];
ZBarSymbol *symb = nil;
NSString *qrCode = nil;
for(symb in symbols)
{
qrCode = [NSString stringWithString:symb.data];
}
NSLog(@"The results = %@",qrCode);
[self dismissModalViewControllerAnimated:YES];
當然,你的委託(readerDelegate) – user1226119 2013-12-20 13:00:10