我正在使用ZBar开发QR码阅读器应用程序。我正在使用XCode 4.2
这是我的代码,我在成功扫描QR码后以模态方式呈现另一个视图,但它不起作用:
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
// ADD: get the decode results
NSString *test3=@"test";
id<NSFastEnumeration> results =
[info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results){
theBarcodeString = symbol.data;
if ([theBarcodeString isEqualToString:test3]){
nextView *next ;
next= [[nextView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:next animated:YES];
}
}
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[reader dismissModalViewControllerAnimated: YES];
}