Re: Custom UIViewController transitions with segues
Re: Custom UIViewController transitions with segues
- Subject: Re: Custom UIViewController transitions with segues
- From: Rick Mann <email@hidden>
- Date: Wed, 30 Dec 2015 18:20:45 -0800
> On Dec 30, 2015, at 18:14 , Roland King <email@hidden> wrote:
>
>
>> On 31 Dec 2015, at 09:12, Rick Mann <email@hidden> wrote:
>>
>> I have a UICollectionView in a UINavigationController, and I'd like to customize the transition from one to the next on push. So I set up the first VC as UIViewControllerTransitioningDelegate, and in prepareForSegue(_:sender:) set the destination VC's transitioningDelegate to self.
>>
>> But my delegate methods never get called. The docs say to set modalPresentationStyle to .Custom, but that has no effect (also, it's a bit weird since this is not technically a modal presentation, is it?).
>>
>> Search for solutions online turns up only custom segues, which is not really what I want.
>>
>> Is it even possible to do this with segues? What am I missing?
>>
>> TIA,
>
> My thought here is that push != present, ie pushViewController(_:animated) doesn’t do the same thing as presentViewController(_:animated:completion) and that push calls the former and other modes call the latter. I dunno what I’d try, the whole UIViewController custom transitioning thing confuses the bananas out of me and I never found the WWDC videos on them to be as helpful as I wished. Perhaps change the push to a present to get it on the screen, then when you’re done with the transition, call pushViewController( vc, animated : false ) to fix up the nav stack. That will probably look really ugly as the nav bar will likely just snap to the new content.
>
> There’s probably 18 other ways to do it. I’d bung some hooks into any methods I could find which run early in the viewcontroller presentation lifecycle and see if there’s a transition coordinator or animation coordinator or whatever objects transitions create which I could hook into and animate alongside.
>
> In general .. having fiddled with custom transitions when the were new and shiny .. I don’t bother with them any more.
It seems to be a common ocurrence that Apple introduces a "helpful" new way to do things that aren't fully integrated with existing "new" (and definitely not deprecated. e.g. segues) ways of doing things, and the documentation and examples are lacking. Bruce Nilo's 2013 presentation on the subject was particularly lacking in information.
Having said that, I found this sample code (which did not turn up when searching the sample code for "transition"), which hopefully works. My biggest beef at this point is that the segue *must* be a modal presentation segue (in fact, it seems all custom transitions are for modal presentation only), which seems like a silly limitation, and is not well-documented.
https://developer.apple.com/library/ios/samplecode/SegueCatalog/Introduction/Intro.html
You're looking for the "Modal" button in that app, which has a custom segue that uses the transition stuff.
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden