Way*_*man 7 iphone uiviewanimation uiviewanimationtransition
我有一个视图控制器具有以下层次结构:
UIViewController
|
| -view
| -presentView(UIView)
| -stagedView(UIView)
| -UIToolbar
我正在使用该transitionFromView:toView:duration:options:completion:方法动画页面卷曲,以便在presentView和之间交换stagedView.当前和分段视图仅覆盖屏幕的大部分,底部有一个UIToolbar.当我使用UIViewAnimationOptionTransitionCurlUp转换时,它会动画整个根视图(包括工具栏),而不仅仅是涉及的两个视图.
[UIView transitionFromView:self.presentView
toView:self.stagedView
duration:0.5f
options:UIViewAnimationOptionTransitionCurlUp
completion:^ (BOOL finished) {
if (finished) {
// cleanup code
}}];
Run Code Online (Sandbox Code Playgroud)
韦恩我建议你使用标签栏,然后实现它的委托方法。我只是为你做的
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
//NSArray *vc= tabBarController.viewControllers;
// for (int i = 0; i < [vc count]; i++) {
// UINavigationController *nc = [vc objectAtIndex:i];
// if (nc == tabBarController.selectedViewController) {
// continue;
// }
[UIView beginAnimations:@"animation" context:nil];
//[self.navigationController pushViewController:nc.topViewController animated:NO];
[UIView setAnimationDuration:1.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:viewController.view cache:NO];
[UIView commitAnimations];
return TRUE;
}
Run Code Online (Sandbox Code Playgroud)
这只是标签栏的逻辑,它只翻转视图而不翻转标签栏。所以我希望你也可以使用工具栏。好吧,它只是给你一个想法。希望它能帮助你