Fork me on GitHub

更改pushViewController和popViewController的动画效果

#import "UINavigationController+ja.h"

// 扩展NavigationController中的方法(catagory)

@implementation UINavigationController (ja)

- (void)pushAnimationDidStop {
}

- (void)pushViewController: (UIViewController*)controller
    animatedWithTransition: (UIViewAnimationTransition)transition {
[self pushViewController:controller animated:NO];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:TT_FLIP_TRANSITION_DURATION];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(pushAnimationDidStop)];
[UIView setAnimationTransition:transition forView:self.view cache:YES];
[UIView commitAnimations];
}

- (UIViewController*)popViewControllerAnimatedWithTransition:(UIViewAnimationTransition)transition {
UIViewController* poppedController = [self popViewControllerAnimated:NO];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:TT_FLIP_TRANSITION_DURATION];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(pushAnimationDidStop)];
[UIView setAnimationTransition:transition forView:self.view cache:NO];
[UIView commitAnimations];

return poppedController;
}

 

@end

posted on 2012-03-03 22:58  pengyingh  阅读(2430)  评论(0编辑  收藏  举报

导航