0
votes

I'm currently using the API provided to define custom controller transition. I read the documentation provided by Apple, see the videos on WWDC and found a lots of blogs speaking about it. I have some questions on how to use those API :

  1. The container view on animateTransition:: in the majority of example code I found and in the WWDC 218 named "Custom Transitions using View controllers", only the view of the "toViewController" is added to the containerView. But in some others example and in the video "Architecting Modern iOS Apps", the showed code adds both the "toViewController" and "fromViewController" to the containerView. When should we deal with both and when with only one ? Is it the same for both dismissing and presenting ?
  2. The initialFrameForViewController: and finalFrameForViewController: from the UIViewControllerContextTransitioning context: The WWDC 218 video told us it is very important to rely on those methods to retrieve the frames for the controllers' views. But in a lot of examples, the are not used at all. I try to used then in a custom animation, but the frame provided could be located outside the screen. How are the frames determined by those methods ? When those methods should be used ? Is it specified in the documentation ?
  3. viewForKey: in iOS8 : should we use this method instead of viewControllerForKey: since iOS 8 ?
  4. Do have the modalPresentationStyle incident on the view hierarchy during a custom Animation Transition ? On the slides provided here : http://es.slideshare.net/Split82/custom-uiviewcontroller-transitions, this seems to have an incidence on initial and final frame. Is it documented somewhere ?
1

1 Answers

0
votes
  1. Regarding what view controllers you need to add, you only have to add the "to" view. The "from" view is already there.

  2. Regarding your finalFrameForViewController, it's probably dictated by things like UIModalPresentationFullscreen vs UIModalPresentationPopover and preferredContentSize.

  3. Regarding viewForKey, this is useful in those cases where the presented view is not the same as the presenting view controller's view (e.g. the custom transition is presenting a popup that also blurs the "from" view, which is full screen, even though the presented view is a small pop-up). In many cases, you don't need viewForKey. It just depends upon what you're doing.

  4. Yes, the modalPresentationStyle affects the frame sizes (e.g. popover vs full screen vs UIModalPresentationNone). The WWDC 2014 video #214 View Controller Advancements in iOS 8 demonstrates this in practice.