iPhone how to turn off animation on leaving a view controller
Im wondering how I can tu开发者_开发百科rn off the animation of my view controller when leaving back to the parent controller. As I can set the animation property for going to the child controller, I guess there must surely be a way to set the property for the leaving task.
Thanks, Markus
It's quite simple. You have to change the back button behavior.
Create this function in your view controller
- (void) popWithoutAnimation {
[self.navigation.controller popViewControllerAnimated:NO];
}
Then change the backBarButtonItem behavior (in your viewDidLoad) :
self.navigationItem.backBarButtonItem.action = @selector(popWithoutAnimation);
self.navigationItem.backBarButtonItem.target = self;
Don't care about syntax I'm just giving you the clues to solve your issue
精彩评论