开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜