0

I have a transparent UINavigationBar. I also set hidesBarsOnSwipe to true. I want my navigationBar be on top of the content and hides when scrolling. Basically i want to achieve this effect (Navigation Bar on top of the content and also hiddes when scroll):

enter image description here

For now i just have this code and works everything, but i'm not able to put the content of the view behind the navigationBar:

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.backgroundColor = .clear
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.hidesBarsOnSwipe = true

enter image description here

Here is a sample project , as you see the tableView is at the bottom of the navigationBar and just goes to the top when it hides the navigationBar.

Godfather
  • 3,686
  • 5
  • 35
  • 64

2 Answers2

0

On your view controller in Interface Builder disable Adjust Scroll View Insets. You can probably do it from code if you want as well.

EmilioPelaez
  • 16,368
  • 5
  • 39
  • 43
-1

check this tuto, it's amazing ;)

http://tobiashelmri.ch/swift,/ios/2016/12/08/hiding-the-status-bar-smoothly-in-ios-10.html

chawki
  • 845
  • 1
  • 8
  • 13