5

Since iOS7 we can create custom transition from view controller to view controller using UIViewControllerTransitioningDelegate which allows fine grained transitions.

viewController.transitioningDelegate  = transitioningDelegate;

I discovered that when using storyboard we already had the opportunity to create custom transitions using a custom UIStoryboardSegue but it seems the only way to implement custom transition with a storyboard.

How can I implement a transition delegate while using storyboard ?

Nicolas Manzini
  • 8,379
  • 6
  • 63
  • 81

2 Answers2

3

Check http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/.

The idea is to use - prepareForSegue: to set the transitioningDelegate and the modalPresentationStyleto UIModalPresentationCustom. Then your transitioning delegate will have to take care of the transition.

Fábio Oliveira
  • 2,346
  • 21
  • 30
  • hello, I have a question: I didn't set `modalPresentationStyle` in the `prepareForSegue` and I have a time gap between `animationControllerForPresentedController` and `animateTransition` method (it was remarkable about 0.4 secs and sometimes even 0.7; my transition animation was 1 second long plus this gap. almost double time.). I tried to find out what is going in this time gap, but this wasn't fault (I think) because I have no process that could create such delay. When I add modalPresentationStyle = UIModalPresentationCustom this gap is disappeared. Why is so? Thanks. – Dima Deplov Feb 07 '15 at 00:17
  • Just a guess: if you simplify your setup you may find there is an animation going on. It may be the case that the way you setup your view hierarchy is not allowing you to see this animation. – Fábio Oliveira Feb 07 '15 at 01:22
3

Check out the following example: https://github.com/soleares/SOLPresentingFun

It's an implementation of the sample code for WWDC Session 218: Custom Transitions Using View Controllers. It uses storyboards.

Jesse
  • 1,667
  • 12
  • 16