This is a common question in StackOverflow, but none of the other solutions worked. Many were also written several years ago.
Here are some of the posts reviewed:
We have several view controllers built into the UINavigationController: A, B, C, D.
A, B use a portrait.
C, D use the landscape.
A is the root controller.
, B A. , B - . , C B, , , :
, , ; , .
, supportedInterfaceOrientations UINavigationController , .
, , .
UINavigationController ( , , , ):
extension UINavigationController {
override open var shouldAutorotate: Bool {
return true
}
override open var supportedInterfaceOrientations : UIInterfaceOrientationMask {
return visibleViewController?.supportedInterfaceOrientations ?? UIInterfaceOrientationMask.landscapeRight
}
}
:
override var shouldAutorotate: Bool {
return true
}
override var preferredInterfaceOrientationForPresentation : UIInterfaceOrientation {
return UIInterfaceOrientation.landscapeRight
}
override var supportedInterfaceOrientations : UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.landscapeRight
}
, :
1) , UINavigationController .
2) VC (, C- > B , D- > C , B- > C , A- > B ).
UINavigationController ( ), . .
?