UINavigationController breaking constraints of child UIViewControllers.

I am setting my Window.RootViewController in my AppDelegate to be a UINavigationController using the following code:

Window = new UIWindow(UIScreen.MainScreen.Bounds); var navigationController = new UINavigationController(new WelcomeViewController()); Window.RootViewController = navigationController; Window.MakeKeyAndVisible();

This works and the view is shown. However, the AutoLayout constraints applied in my WelcomeViewController no longer work. When I don't use the UINavigationController and set the RootViewController to my WelcomeViewController directly the layout works fine. I've tried subclassing UINavigationController and setting the TranslatesAutoresizingMaskIntoConstraints property to false. This fixes the vertical constraints, however the width of the view is incorrect.

How can I use UINavigationController with AutoLayout

Answers

Sign In or Register to comment.