-1

I wonder if its OK by iOS Human Interface Guidelines to style a UIView so it looks and acts like a navbar.

My problem is that I want to hide my current navbar once the user scrolls. I have tried both self.navigationController?.setNavigationBarHidden(true, animated: true) and navigationController?.hidesBarsOnSwipe = true but the animation looks odd, once the navigation bar gets hidden I still have about 20px space under the status bar: You can look at my other question

So to make things easier, can I just init my view tih the navbar hidden and style my own and add the proper animation?

Community
  • 1
  • 1
user2636197
  • 3,982
  • 9
  • 48
  • 69

1 Answers1

0

Try this out :

extension YourViewController {
   override func prefersStatusBarHidden() -> Bool {
      return barsHidden // Custom property
   }

   override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
      return .Slide
   }
}

You have to update barsHidden somewhere in the code and call setNeedsStatusBarAppearanceUpdate() method.

Dipen Gajjar
  • 1,338
  • 14
  • 23