Ios 在zbar完成PickingMediaWithInfo后更改视图(情节提要)
我还不熟悉iPhone上的编程,也研究过我的问题,但没有任何解决方案 我已经成功地跟随在一个标签控制器中,在最后有一个工作的应用程序Ios 在zbar完成PickingMediaWithInfo后更改视图(情节提要),ios,storyboard,xcode4.5,zbar-sdk,uitabcontroller,Ios,Storyboard,Xcode4.5,Zbar Sdk,Uitabcontroller,我还不熟悉iPhone上的编程,也研究过我的问题,但没有任何解决方案 我已经成功地跟随在一个标签控制器中,在最后有一个工作的应用程序 - (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info { // ADD: get the decode results id<NSFastEnumeration
- (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)
// EXAMPLE: just grab the first barcode
break;
ProductViewController *product = [self.storyboard instantiateViewControllerWithIdentifier: @"ProductView"];
product.resultImage = [info objectForKey: UIImagePickerControllerOriginalImage];
product.resultText = symbol.data;
[reader dismissModalViewControllerAnimated:YES];
[self presentModalViewController:product animated:YES];
}
我想做的是,将结果移动到一个单独的ViewController
- (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)
// EXAMPLE: just grab the first barcode
break;
ProductViewController *product = [self.storyboard instantiateViewControllerWithIdentifier: @"ProductView"];
product.resultImage = [info objectForKey: UIImagePickerControllerOriginalImage];
product.resultText = symbol.data;
[reader dismissModalViewControllerAnimated:YES];
[self presentModalViewController:product animated:YES];
}
-(无效)imagePickerController:(UIImagePickerController*)读卡器
didFinishPickingMediaWithInfo:(NSDictionary*)信息
{
//添加:获取解码结果
id结果=
[信息对象forkey:ZBarReaderControllerResults];
ZBarSymbol*符号=nil;
用于(结果中的符号)
//示例:只需抓取第一个条形码
打破
ProductViewController*product=[self.storyboard instanceeviewcontrollerwhiteIdentifier:@“ProductView”];
product.resultImage=[info-objectForKey:UIImagePickerControllerOriginalImage];
product.resultText=symbol.data;
[reader dismissModalViewControllerAnimated:是];
[self-presentModalViewController:产品动画:是];
}
我在代码中遇到的问题是产品视图控制器从未显示
使用Xcode 4.5、iOS 6 SDK。您尝试过吗
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ProductView"];
[reader presentViewController:newTopViewController animated:YES completion:nil];
我最终放弃了上述方法,而是在navigigation控制器上添加了处理显示的功能 显示扫描:
[[self-targetController]显示新对象:扫描]代码>
在接收端:
- (void)displayNewObject:(_Scan *)scan
{
self.scan = scan;
self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:1];
[[self navigationController] popToRootViewControllerAnimated:NO];
[self performSegueWithIdentifier: @"ShowScanDetail" sender: self];
self.scan = nil;
}
我的问题没有得到答案,所以我不得不把我的问题改写成更容易处理的问题。我已经用我提出的解决方案更新了我的问题。如果有人想要更多的细节,那么我可以发布更多