我在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];
}];
答案 0 :(得分:0)
你必须在[self procesarCheckInConQR:qr]