Here is how to hide Navigation Bar on Scroll in your Apple iOS App with single line of code!

Assumption: I assume your have embedded in UINavigationBar in your Apple iOS App inside Storyboard.

 
If you want to mimic Apple Safari iOS App’s behaviour of hiding navigation bar on scroll you can do it in just single line of code without any hassle.

 
You have to add following code in your View Controller’s viewDidAppear function where you have added UINavigationBar in storyboard:

 

navigationController?.hidesBarsOnSwipe = true

 
Now your viewDidAppear function will look like this:

 

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationController?.hidesBarsOnSwipe = true
}

 
Hope it helps,

 
Thanks & Regards
Mandar Apte

Mandar Apte

This website contains a design articles blog by Mandar Apte. He writes and shares his iOS development, graphic, web, & animation film design experience through articles. Mandar is Mumbai based multi-disciplinary designer with expertise in UI, UX, Logo, Symbol, and Brand Identity design. He is an alumnus of Sir J. J. Institute of Applied Art, Mumbai. He currently runs his studio in the heart of the city of Mumbai.

Leave a Reply

Your email address will not be published. Required fields are marked *