3

While searching how to perform custom animations when transitioning from one controller to another I found some info about UIViewControllerAnimatedTransitioning.

So the question is: why do we even need this if we have custom segues? Are they interchangeable or not? If yes, why does Apple provide two ways of doing the same task?

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
hasrthur
  • 1,410
  • 15
  • 31

1 Answers1

3

Some differences:

  • Segues can only be used with storyboards.
  • Animator objects can be used programmatically, or along with segues.
  • Animator objects allow you to set a customized final position and size for your new view controller.
  • Animator objects can be configured to do special animations with navigation controllers and collection views.
  • Animator objects also allow interactive transitions using UIViewControllerInteractiveTransitioning, which segues don't.
Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
  • thanks for the answer. but is it OK to have a segue in storyboard between controllers and configure custom transition in code for those two controllers? and if so, could you please point to a relative tutorial or some apple article since I have found the tutorials only about either one thing or another – hasrthur Mar 02 '15 at 07:18
  • 2
    It's OK to do whatever you want! :) http://www.objc.io/issue-5/view-controller-transitions.html combines segues and animator objects. And http://www.albertopasca.it/whiletrue/2013/10/objectivec-uistoryboard-custom-transition/ subclasses `UIStoryboardSegue` to create a custom animation. – Aaron Brager Mar 02 '15 at 07:27
  • as far as I understand segues are just visual representations of the transitions in storyboard and just use the default animation controllers if programmer doesn't implement the required protocols? And if I implement the protocols then when I write `performSegueWithIdentifier("PushToDetaildSegue", sender: self)` it will use the animator provided by me? – hasrthur Mar 02 '15 at 08:15