GJain
GJain

Reputation: 5093

How to present view bottom to top when using navigationController

ViewController *viewController = [[ViewController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];

With above code, the "ViewController" moves from right-to-left.

Is it possible to present "ViewController" bottom-to-top?

I tried but it does not work.

viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

I created "Navigation Controller" as follows

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
[navController setNavigationBarHidden:YES];

Upvotes: 1

Views: 2348

Answers (2)

Jagat Dave
Jagat Dave

Reputation: 1645

If you want to present a view controller then on button click event you have to write following code. I hope this will work for you :

DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:NSStringFromClass([DetailViewController class]) bundle:nil];

[self.navigationController presentViewController:detailViewController animated:YES completion:nil];

Upvotes: 0

ozz
ozz

Reputation: 1137

Most bottom-to-top animations of a new view controller involve the presentation of the view controller using:

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion

Your code involves a navigation stack push, which is usually a right-to-left animation.

Upvotes: 2

Related Questions