iPhone SDK的NavigationController提供的动画效果默认只有一种,如何实现各种不同的呢?
下面是来自three20的实现,大家只要把这两个方法作为UINavigationController的Category方法调用就可以了
(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;
}

本文介绍了一种自定义iPhone SDK中NavigationController动画的方法。通过将两个特定方法作为UINavigationController的Category方法调用,可以轻松实现不同的动画效果。
850

被折叠的 条评论
为什么被折叠?



