With the UIView
animation API and view controller containment the current Cocoa Touch stack is very well suited for automatic transitions between view controllers.<
I feel a bit odd trying to answer this... like I'm just not understanding the question, because you no doubt know this better than I do, but here goes.
You've using the containment API and written the transition yourself, but your unhappy with the result? I've found it very effective so far. I've created a custom container view controller with no view content(set the child view to be full screen). I set this as my rootViewController
.
My containment view controller comes has a bunch of pre-canned transitions (specified in an enum
) and each transition has pre-determined gesture to control the transition. I use 2 finger panning for left/right slides, 3 finger pinch/zoom for sort of grow/shrink to the middle of the screen effect and a few others. There is a method to setup:
- (void)addTransitionTo:(UIViewController *)viewController withTransitionType:(TransitionType)type;
I then call methods to setup my view controller swap outs.
[self.parentViewController addTransitionTo:nextViewController withTransitionType:TransitionTypeSlideLeft];
[self.parentViewController addTransitionTo:previousViewController withTransitionType:TransitionTypeSlideRight];
[self.parentViewController addTransitionTo:infoViewController withTransitionType:TransitionTypeSlideZoom];
The parent container adds in the appropriate transition gestures for the transition type and manages the interactive movement between the view controllers. If you are panning and you let go in the middle, it will bounce back to whichever one was covering the majority of the screen. When a full transition is complete, the container view controller removes the old view controller and all the the transitions which went with it. You can also remove transitions anytime with the method:
- (void)removeTransitionForType:(TransitionType)type;
While the interactive transitions are nice, there are some cases when I do want non-interactive transitions too. I use a different type for that, because I do have some transitions which are only static because I have no clue what gesture would be appropriate for them to be interactive (like cross fade).
- (void)transitionTo:(UIViewController *) withStaticTransitionType:(StaticTransitionType)type;
I originally wrote the container for a slide deck sort of app, but I've turned around and re-used it in a couple apps since then. I have not yet pulled it out into a library to re-use, but it's probably just a matter of time.