Custom iOS segues, transitions, and animations the right way
Let’s take a simple scenario: you have two
UIViewControllers within a
UINavigationController and you want the transition between them, in both directions, to be a fade-in effect rather than the usual slide-in/out effect.
There’s a lot of bad examples out there of how to do this. If you see anything suggesting you should call
UIView.animateWithDuration inside a custom
UIStoryboardSegue class, stop right there, and be glad you read this post.
Unfortunately even Apple’s documentation implies that you should do this, but it just hasn’t been updated to the more powerful approach introduced in iOS 7.
I’m going to show you the right way. It takes a few minutes longer to get your head around it, but once you do, you’ll have a lot more power for your custom transitions. You can follow along using the Xcode Master-Detail Application template.
Segues vs Transitions
I’m going to divide the...
Continue reading →