Is there a way to use UIViewAnimationOptionTransitionCurlUp without it animating the entire screen?

我的梦境 提交于 2019-12-03 00:28:57

I've been struggling with this issue and the only way I could resolve it is that I put the fromView into another view. In your case the view hierarchy should look like this:

UIViewController
|
|-view
   |-containerView
      |-presentView
   |-stagedView
   |-UIToolBar

The fromView parameter still should point to presentView. Hope this helps.

This tutorial explains it perfectly.

http://joris.kluivers.nl/iphone-dev/?p=CurlTransition

Basically, you want to create a container view which will be the view we'll be animating, you could call it containerView. This container view will already have a subview added to it which can fill the entire containerView. Then use the code below when you want to animate to the next view. You remove the present view and add the next view. In the end, you are really transitioning between your containerView. Which itself is being changed after the animation begin statement.

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5f];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:containerView cache:NO];
[presentView removeFromSuperview];
[containerView addSubview:nextView];
[UIView commitAnimations];

Wayne i suggest you to use the tab bar and then implement its delegate method.I just did it for you

   - (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;

    }

Here is just the logic with the tab bar,it only flips the view not the tabbar.So i hope the same you could with ToolBar. Well it will just give you idea.Hope it could help you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!