Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push to a UIViewController from a presentViewController

I want to push to a new viewcontroller from a presented viewcontroller. I don't want to dismiss the presented viewcontroller. I want the new viewcontroller to come over the presented viewcontroller.

Can anybody tell me how to do that.

like image 725
Santosh Avatar asked Feb 26 '26 02:02

Santosh


2 Answers

You do not push form the presented controller so the best option is

First you have to dismiss the controller without animation and then in the method of -(void)viewWillApper you can easly push to the controller where you want to push.

like image 128
PAn Kaj Khatri Avatar answered Feb 28 '26 15:02

PAn Kaj Khatri


You can do by using UINavigationController like

UINavigationController *vcObject = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"YourViewController"];
[self.navigationController presentViewController:vcObject animated:YES completion:NULL];

Now you can easily push or pop to other ViewController like you want.Thankyou

like image 26
baydi Avatar answered Feb 28 '26 14:02

baydi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!