Reputation: 4360
I have written a custom UIStoryboardSegue.
The only code in my CustomSegue.m file is:
-(void) perform {
UIViewController* sourceViewController = (UIViewController *) self.sourceViewController;
UIViewController* destinationViewController = (UIViewController *) self.destinationViewController;
UIWindow* window = UIApplication.sharedApplication.keyWindow;
window.rootViewController = destinationViewController;
window.rootViewController = sourceViewController;
[UIView transitionWithView: sourceViewController.view.window
duration: 0.5
options: UIViewAnimationOptionTransitionFlipFromLeft
animations: ^{window.rootViewController = destinationViewController;}
completion: ^(BOOL finished) {}
];
}
If I set up a storyboard so it just has two UIViewControllers, with a button on the first linking to the second, all works as planned: there is a flip from left transition.
But: if I place a UINavigationController before the first UIViewController, the segue now brings up the second view controller without doing a flip from left.
What is going on? Why doesn't the transition work with a navigation controller?
Thanks for your help!
(In case you're interested, the reason I'm using a custom segue is so that I can have a master-detail view appearing after some intro pages. I am inspired by this Stackoverflow answer.)
Upvotes: 0
Views: 443
Reputation: 4360
I never resolved this, but found a simple workaround. I removed the navigation controller from the front, but put one after the segue instead. I then put a simple navigation bar at the top of the source screen. The segue also triggered adding a back button to the destination view controller. My custom segue thus became a "pseudo push" segue.
Upvotes: 1