Skip to content

Instantly share code, notes, and snippets.

@ArtSabintsev
Last active April 29, 2017 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArtSabintsev/98042a052f27f0b288ceb6d050690bbb to your computer and use it in GitHub Desktop.
Save ArtSabintsev/98042a052f27f0b288ceb6d050690bbb to your computer and use it in GitHub Desktop.
Portrait Mode Navigation Controller
/// Constrains child ViewController's to be in portrait mode when loaded within this specific Navigation Controller stack.
final class PortaitNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
// Hide Border
navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationBar.shadowImage = UIImage()
}
}
// MARK: - ViewController Override
extension PortaitNavigationController {
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
}
override var shouldAutorotate: Bool {
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment