developerabhi
developerabhi

Reputation: 3

how to make navigation bar always appear on top and not scroll with content IOS 8

I want to show navigation bar always visible on top while scrolling view . Kindly share code or sample if integrated. I want similar to facebook app navigation bar.

Upvotes: 0

Views: 2330

Answers (2)

0ndre_
0ndre_

Reputation: 3631

At first you need to have navigation controller (Editor -> embed in -> Navigation Controller) while your view controller is selected. Then use Show(e.g.Push) or Show Detail as a storyboard segue kind. Navigation bar will automatically appear.

This code hides bar:

self.navigationController?.navigationBarHidden = true

This shows bar:

self.navigationController?.navigationBarHidden = true

This code hides bar on swipe (like facebook app)

 self.navigationController?.hidesBarsOnSwipe = true 

This should keep bar visible

 self.navigationController?.hidesBarsOnSwipe = true 

Upvotes: 1

Bharath Vankireddy
Bharath Vankireddy

Reputation: 932

When you set navigation controller, navigation bar will be always at the top as fixed. Your container starts from below the navigation bar.

self.navigationController.navigationBarHidden = false

In fact you don't even have to write this code, because default functionality of navigation bar is visible always.

Upvotes: 0

Related Questions