I have a custom button on a view controller in the navigation controller's heirarchy, that when pressed, pops the visible view controller.
I want to use UIView's transform
property to animate the closing of the view controller. It works, but if I use `popViewControllerAnimated:YES', the default left slide of the animation is still there, though my custom transform also works.
If I set popViewControllerAnimated:NO
it doesn't animate anything at all.
I also looked into using CATransition
which works when I have popViewControllerAnimated
set to NO
, but there isn't a "zoom" effect that's part of the public API, and I don't want to use the private effect. Custom filters are also not available for iPhone, only OS X.
So I guess my questions are:
1) Is there a way to remove the the left slide in the default transition yet still have a custom animation using transform
?
2) Some way to use a custom filter for CATransition
?
3) If I use a private API for the zoom effect how likely will Apple toss my app in the rejection bin?
Does anyone have a solution I'm overlooking?
I've done something similar to what you describe, i.e. change the default animation for pop and push of view in UINavigationController.
The idea is to disable the default animation for the object and replace it with your own animation. I've created a new category for UINavigationController and used a function similar to the one below.
to use just use the code
In order to do a push just create another similar function and reverse the animation.
It's not perfect but it works. When you choose different animation types play around with the different subviews composing the navigation bar/controller to get it perfect.
Took my quite a white to come up with this, so use it wisely :)
******* EDIT
Try replacing the push transition with this (Didn't try it myself):
This will do a pop in, i.e. the view will be bigger before it settles to the right size. Play with the values in the array to control the curve of the animation.