Showing Pushviewcontroller Animation Look Like Presentmodalviewcontroller

Showing pushviewcontroller animation look like presentModalViewController

Try this :

UIViewController *yourViewController = [[UIViewController alloc]init];

[UIView beginAnimations: @"Showinfo"context: nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController: yourViewController animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[UIView commitAnimations];

Push ViewController with modal animation (horizontal flip)

You really should be using block based animations now. Also, if you're instantiating a storyboard controller from a controller that's also in the same storyboard, you can more easily access that storyboard with self.storyboard.

-(IBAction)flipToNext:(id)sender {
SecondController *next = [self.storyboard instantiateViewControllerWithIdentifier:@"Next"];
[self.navigationController pushViewController:next animated:NO];
[UIView transitionWithView:self.navigationController.view duration:1 options:UIViewAnimationOptionTransitionFlipFromRight animations:nil completion:nil];
}

Using pushViewController after presentModalViewController

If you presentModelViewController then you need to dismiss it before you can call the navigation controller's methods, otherwise you have to put this view controller into the navigation stack in order to put another view controller on top of it.

Push View from Presented View Controller in iOS

You have to Push from your firstView (MainViewController), but you can use animation same as PresentView and DismissView. Use following code for this :-

For Push (on MainViewController)

LoginViewController *VC = [[LoginViewController alloc]init];
CATransition* transition = [CATransition animation];
transition.duration = 0.3f;
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromTop;
[self.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[[[UINavigationController alloc] initWithRootViewController:VC] pushViewController:VC animated:NO];
//[self.navigationController pushViewController:VC animated:NO];

For Pop (on LoginViewController)

CATransition* transition = [CATransition animation];
transition.duration = 0.3f;
transition.type = kCATransitionReveal;
transition.subtype = kCATransitionFromBottom;
[self.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[self.navigationController popViewControllerAnimated:NO];

Using this code, you can get animation same as Present-Dismiss ViewControllers. Refer this answer for more details.

And after that, you can use your code for Pushing LoginViewController to HomeViewController

Hope, this is what you're looking for. Any concern get back to me. :)

`pushViewController:animated:` with fade animation (animate transition only)?

link

The best solution from it is animating way which works for my case.

The most strange thing is to disable view controller's own animation instead of its changing.

PresentModalViewController with the same animation as push view in a navigation controller?

As far as I know, it can't move horizontally. And what's more, when you use presentModalViewController:animated:, the previous view will disappear(be blank). But you can do like this(add your desired view to the top of your window):

UIViewController *modalViewController = [[UIViewController alloc] init];
[modalViewController.view setFrame:CGRectMake(320.0f, 0.0f, 320.0f, 480.0f)];
[modalViewController.view setBackgroundColor:[UIColor redColor]];
[[UIApplication sharedApplication].delegate.window addSubview:modalViewController.view];

[UIView animateWithDuration:0.25f
delay:0.0f
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
[modalViewController.view setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
}
completion:nil];

[modalViewController release];


Related Topics



Leave a reply



Submit