编辑问题从头开始恢复。
我有一个ViewController A,它有一个导航条按钮,它显示了源代码类型UIImagePickerControllerSourceTypeCamera的UIImagePickerController,我们称之为ViewController B。在didFinishPickingMediaWithInfo:方法A中,我介绍了ViewController C。
问题现在从这里开始。当我最终到达C时,我们可以清楚地看到视图堆栈是:
A -模态-> B --> C
在C中,导航栏上有一个" back“按钮,它将带我回到B。但是,由于B是一个UIImagePickerController,所以我不能重用它,因此必须取消它。因此,为了实现这一点,我目前在C上为"Back“按钮执行了以下方法
- (IBAction)backOnPost:(UIBarButtonItem *)sender
{
[self.view endEditing:YES];
UINavigationController *LogControl = [self.storyboard instantiateViewControllerWithIdentifier:@"LogControl"];
RGLogViewController *logView = (RGLogViewController *)LogControl.topViewController;
[UIView animateWithDuration:0.25 animations:^{
self.presentingViewController.view.alpha = 0;
[self.presentingViewController dismissViewControllerAnimated:NO completion:nil];
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil];
} completion:^(BOOL finished){
[logView setBoolBackPushed];
}];
}上面的代码的工作原理是,通过取消B、和C,我回到了A。然而,您仍然可以看到过渡,因为有一点“黑色筛选”从两个ViewControllers的解雇。您可以在完成块[logView setBoolBackPushed];中看到,这将一个静态BOOL变量设置为true,以便A的viewWillAppear:的开头立即显示一个新的UIImagePickerController -该方法如下所示:
- (void)viewWillAppear:(BOOL)animated
{
NSLog(@"HERES postBackButtonPushed:%hhd", postBackButtonPushed);
if(postBackButtonPushed == true)
{
self.view.hidden = YES;
self.navigationController.navigationBar.hidden = YES;
self.tabBarController.tabBar.hidden = YES;
UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
[self presentViewController:imagePicker animated:NO completion:^{}];
}这是目前我如何获得以下期望的效果:从A到照相机(B),到C,然后返回到新相机,这是我们新的B。这实现了几乎完美的无缝转换。
我仍然有问题,不能稍微看到过渡。另一个问题是时机问题。这种解散和展示ViewControllers的协作比我所希望的要花费更多的时间。几乎是瞬间的,但我想要更好的东西。我该怎么做,我是不是做错了什么?
发布于 2015-07-24 12:18:25
有一些可能导致您的问题的案例:
发布于 2015-07-31 06:37:16
我相信这对你有用。做!
[self.presentingViewController dismissViewControllerAnimated:NO completion:^{
[RefrenceOfPreviousViewController dismissViewControllerAnimated:YES completion:^{
}];
}];而不是
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:NO completion:nil];https://stackoverflow.com/questions/31396193
复制相似问题