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

I have a view controller that has the following hierarchy:

UIViewController
|
| -view
| -presentView (UIView)
| -stagedView (UIView)
| -UIToolbar

I use the transitionFromView:toView:duration:options:completion: method to animate a page presentView for sharing between presentView and stagedView . Presented and delivered presentation covers only most of the screen, and at the bottom - UIToolbar. When I use the UIViewAnimationOptionTransitionCurlUp transition, it animates the entire root view (including the toolbar), and not just the two views.

 [UIView transitionFromView:self.presentView toView:self.stagedView duration:0.5f options:UIViewAnimationOptionTransitionCurlUp completion:^ (BOOL finished) { if (finished) { // cleanup code }}]; 

Is there a way to just bring two subtitles to life by leaving the toolbar alone? If so, how?

+7
source share
3 answers

I am struggling with this problem, and the only way I could solve it is that I put fromView into a different view. In your case, the view hierarchy should look like this:

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

FromView should still point to presentView. Hope this helps.

+3
source

This tutorial explains it perfectly.

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

Basically, you want to create a container view that will be an animation to view, you can call it containerView. A subview has already been added to this container view, which can fill the entire container view. Then use the following code if you want to animate the following view. You delete the current view and add the following view. In the end, you really go between your container. Which itself changes after the approval of the animation.

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

Wayne, I suggest you use the tab bar and then implement its delegation 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; } 

That's just the logic with the tab bar, it only flips the view, not the tab. Therefore, I hope that you are also with the ToolBar. Well, that just gives you an idea. Hope this helps you.

0
source

All Articles