lavanya
lavanya

Reputation: 45

Present ModalViewcontroller from another modalviewcontroller

I am not able to present the modalviewcontroller from another modal view controller. I have first ViewController(vc1), in that I click on a uibutton to present a view controller modally(vc2) and in vc2, I click on uibutton to present another view controller modally vc3. so I am not seeing a vc3 on the top of vc2.

My sample code for the button click in vc2 is :

var vc3 = new UIViewController();
vc3.ModalPresentationStyle = UIModalPresentationStyle.CurrentContext;  
((UINavigationController)UIApplication.SharedApplication.Windows[0].RootViewController).VisibleViewController.PresentViewController(vc3, true,null);

Upvotes: 1

Views: 656

Answers (1)

pinedax
pinedax

Reputation: 9356

For this your first presented Modal ViewController needs to be fullscreen. Before presenting it change its ModalPresentation Style.

var yourOtherModalViewController = new YourOtherModalViewController();
yourOtherModalViewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;

Upvotes: 1

Related Questions