tags:

views:

288

answers:

3

i am new to iphone application development. I have a mainmenu view controller, which has a login button. once i click the login button i display the next login view controller by calling this

LoginController *lc2=[[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];

UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:lc2];
[self presentModalViewController:navigationController animated:YES];

But this view appears to come from the right side of the screen,i want to provide the effects like, curl or flip,when i navigate from one view controller to another. Please help me with the code to provide this effect

A: 

Perhaps something like this, separating the animation code from the modal view controller's presentation code:

LoginController *lc2=[[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];

UINavigationController *navigationController = 
      [[UINavigationController alloc]initWithRootViewController:lc2];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:YES];

[self presentModalViewController:navigationController animated: NO];
[UIView commitAnimations];
luvieere
thanks for the prompt reply.. but i see on the buttons or the label showing the effect, i want the entire page,to show the effect
shreedevi
A: 

I quite agree with luvieere, except I think that the view specified in

[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:YES];

must be the container view, in wich a subview will be added or removed, and I'm not sure if navigationController.view is the container view. I would try with different combinations, including self.view, self.view.superview (that depends of the behavior of "presentModalViewController").

Unfalkster
thanks for the prompt reply.. but i see on the buttons or the label showing the effect, i want the entire page,to show the effect
shreedevi
+1  A: 

Check the Metronome example from Apple's SDK. Its a bit too much code for posting it right here, hence I would like to point you to that example. The basic idea is using a parent view-controller that handles the transitions between two or more child view-controllers. That involves setting up a protocol for smoothly allowing the child-view-controllers to inform the root-view-controller about transitions to do. Bit vague, I know - so please jump into the example code.

Till
thanks thanks a lot!!!!it worked....
shreedevi
glad that did help you to find the right way ... feel free to accept my answer ;)
Till