In my experiments, it seems that you cannot have a standard presentation (cover the vertical) after a partial curl and simultaneously release both of them, unless you are firing with an animation set to NO.
The way to fix this, however, is to reject secondVC without animation (this code is in the secondVC):
-(IBAction)dismissSelf:(id)sender { [self dismissViewControllerAnimated:NO completion:nil]; }
Then, in firstVC, release the viewDidAppear with the animation again, after checking that the controller is not displayed:
-(void)viewDidAppear:(BOOL)animated { if (![self isBeingPresented]) { [self dismissViewControllerAnimated:YES completion:nil]; } }
While the above code works to return to the initial controller view, you will see that the firstVC window appears before calling curl. If you don't want to see this, then the only way I could find to fix this was to create a secondVC image, add this as (as an image) a subview in firstVC before you fired secondVC. Thus, for this you need to use the code in secondVC (note that you need to connect to QuartzCore and import it into secondVC for this):
-(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; UIImage *img = [self imageWithView:self.view]; FirstViewController *first = (FirstViewController *)self.presentingViewController; UIImageView *iv = [[UIImageView alloc] initWithFrame:first.view.bounds]; iv.image = img; [first.view addSubview:iv]; } -(IBAction)dismissSelf:(id)sender { [self dismissViewControllerAnimated:NO completion:nil]; } - (UIImage *)imageWithView:(UIView *)view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, [[UIScreen mainScreen] scale]); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; }
source share