I want to show a modalview on a viewController. (which has a naviguation controller).
On my view i have text, and a button to show the modalview.
I created
In the PresentingViewController
copy the below code under storyboard segue or IBAction.
SecondViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"secondViewController"];
//SecondViewController *viewController = [SecondViewController alloc]init]; // if you are adding the viewcontroller programatically
viewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[viewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:viewController animated:YES completion:nil];
In the second ViewController
do the following steps either by storyboard or through code:
self.view
) backgroundcolor to clearcolor and reduce the opacity to 50 %