Reputation: 33
I am trying to make a custom seque where src falls down revealing dst. This is what I currently have. How can I make dst be behind src?
-(void)perform {
UIViewController *src = [self sourceViewController];
UIViewController *dst = [self destinationViewController];
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationCurveEaseIn
animations:^{
[src.parentViewController.view setTransform:CGAffineTransformMakeTranslation(0, src.view.bounds.size.height)];
}
completion:nil];
[src presentViewController:dst animated:NO completion:nil];
}
Upvotes: 3
Views: 1113
Reputation: 31294
Rather than arranging your destination view controller be behind your source controller, why not try this instead: render your source view controller to an image view, add that image to your source controller, and then animate the image falling down.
This has a number of benefits: firstly, whatever you end up doing you may need to render your source view controller out to an image anyway for performance reasons. Secondly, it avoids having to mess around with the view controller hierarchy.
If that wasn't totally clear, here it is step by step:
UIImageView
UIImageView
to your destination view controller (so that it covers the destination view entirely)UIImageView
falling down to reveal the view content beneath itUpvotes: 2