我在 didFinishPickingMediaWithInfo 下运行一个函数,但是在函数完成后如何渲染另一个 viewController
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
id<NSFastEnumeration> results =[info objectForKey: ZBarReaderControllerResults];
NSString *qr;
for (ZBarSymbol *symbol in results) {
NSLog(@"Resultado: %@", symbol.data);
qr = symbol.data;
}
[reader dismissViewControllerAnimated:YES completion:^{
[self procesarCheckInConQR:qr];
}];
}
我尝试添加
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"rootCarta"];
[reader presentViewController:newTopViewController animated:YES completion:nil];
后
[reader dismissViewControllerAnimated:YES completion:^{
[self procesarCheckInConQR:qr];
}];
并且视图被渲染,但是来自 [self procesarCheckInConQR:qr] 的数据;还没准备好
更新: 我没有解雇我提出新的视图控制器,但我仍然没有来自 procesarCheckInConQR:qr 的数据
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"rootCarta"];
[reader presentViewController:newTopViewController animated:YES completion:^{
[self procesarCheckInConQR:qr];
}];