3

I have looked at several attempts to maintain the size and position of the UINavigationBar when hiding the status bar. None of them seem to work (iOS 11).

Edit: Solution https://stackoverflow.com/a/44066303/3418097

I've tried subclassing the UINavigationBar and overriding sizeThatFits:

class CustomNavigationBar: UINavigationBar {
    override func sizeThatFits(_ size: CGSize) -> CGSize {
        var size = super.sizeThatFits(size)
        if UIApplication.shared.isStatusBarHidden {
            size.height = 64
        }
        return size
    }
}

The navigation bar will still "shrink" when the status bar is hidden. How can achieve this? Apps like Slack and Google inbox manage.

andromedainiative
  • 4,414
  • 6
  • 22
  • 34

0 Answers0