Naresh G
Naresh G

Reputation: 21

Unable to call navigation controller from present view controller in ios

In my application i am launching one screen using present UIModalViewController and on that screen I have oneUIButton, if we click on that UIButton alert will come then select yes on alert view now we have to call another view usingpushviewcontroller. But screen is not coming if we use below code can any one help me.

[self.navigationController pushViewController:requestViewController animated:YES];

Upvotes: 0

Views: 1297

Answers (1)

Vinod N
Vinod N

Reputation: 148

Try with one root navigation controller and then present your controller modally as follows :

FirstViewController *firstView=[[FirstViewController alloc]init];
UINavigationController *navigationController = [[UINavigationController alloc]                                               initWithRootViewController:firstView];
[self presentViewController:navigationController animated:YES completion:nil];

and then for push another view as follow :

SecondViewController *secondView=[[SecondViewController alloc]init];     
[self.navigationController pushViewController:secondView animated:YES];

It will work first using present modal viewController and then using push navigation viewControllers on to the stack.

Upvotes: 1

Related Questions