我想为 Scan Books 条形码创建应用程序,但是当我可以成功扫描条形码时,ZBarReaderViewController 不会在 imagePickerController didFinishPickingMediaWithInfo 委托中关闭,并且我收到警告:
警告:在演示或关闭过程中尝试从视图控制器中关闭!
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results)
// EXAMPLE: just grab the first barcode
break;
// EXAMPLE: do something useful with the barcode data
resultLable.text = symbol.data;
isbnResultString=symbol.data;
NSLog(@"isbnResultString-----%@",isbnResultString);
isbnLableText.text=isbnResultString;
NSLog(@"%@",[info objectForKey: UIImagePickerControllerOriginalImage]);
// EXAMPLE: do something useful with the barcode image
barCodeImageView.image=[info objectForKey: UIImagePickerControllerOriginalImage];
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[self dismissViewControllerAnimated:YES completion:nil];
if (isbnResultString.length!=0)
{
if(![self connectedToInternet])
{
[appDelagate showActivityIndicator];
appDelagate.isNetConnected=NO;
[self internetAlert];
}
else
{
[self getBookDetailsByISBN:symbol.data];
}
}
}
如何关闭 ZBarReaderViewController?