I have UIView where a UIStackView is a subview. Normally it fills the UIView. However, when I embed the UIView in a UINavigationController the UIView and UIStackView no longer extend to the bottom of the screen. It seems that they are getting a height that is only necessary to contain the UIStackView's subviews and nothing more. Here's what the constraints code looks like:
func setContraints() {
readableContentGuide.topAnchor.constraint(equalTo: stackView.topAnchor, constant: 0.0).isActive = true
readableContentGuide.bottomAnchor.constraint(equalTo: stackView.bottomAnchor, constant: 0.0).isActive = true
readableContentGuide.leadingAnchor.constraint(equalTo: stackView.leadingAnchor, constant: 0.0).isActive = true
readableContentGuide.trailingAnchor.constraint(equalTo: stackView.trailingAnchor, constant: 0.0).isActive = true
stackView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor)
stackView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor)
}
This line from above has no effect:
stackView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor)
And here is how I'm setting up the UINavigationController in AppDelegate:
window = UIWindow()
let homeViewController = BeginCheckoutViewController()
let navController = UINavigationController(rootViewController: homeViewController)
self.window?.rootViewController = navController
window?.makeKeyAndVisible()