Tutorial :Custom transitions between view controllers?



Question:

Is there a good way to provide custom transitions between view controllers? For example, in the Photos app on the iPad, tapping on a photo album changes the navigation controller, but it also animates nicely into the grid of photos.

Thanks.


Solution:1

If the nice animation you're referring to is the photo grid sliding into view from the right, that's handled by the UINavigationController automatically. You just tell it which view you want to show and it will handle the slide animation for you.

This sets up the navigation controller with your first view (the photo album table) on it.

// init your first view controller here, create a navigation controller for it  UIViewController *myRootViewController;  UINavigationController *myNavController;  myNavController = [[UINavigationController alloc]                     initWithRootViewController:[myRootViewController view]];  // the nav controller now owns your first view  [myRootView release];  // add the nav controller view (ie. do this in the app delegate)  [window addSubView:[myNavController view]];  

Then create the second view (the photo grid) and ask the navigation controller to display it.

// init your second view controller here  UIViewController *mySecondViewController;  [myNavController pushViewController:[mySecondViewController view] animated:YES];  [mySecondView release];  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »