Jack Gruber
Jack Gruber

Reputation: 163

How to present view controller modally while keeping navigation bar present. (For a settings view controller)

Here is an example of what I'm talking about: https://media.giphy.com/media/3o6nUPLqKrMN64tdNm/giphy.gif Many apps do this. The contacts app when you add a new contact, etc. When I try to present my settings page modally, however, the navigation bar disappears. Any idea how to get around this? Thanks in advance!

Upvotes: 2

Views: 5922

Answers (1)

Bilal
Bilal

Reputation: 19156

Create a navigation controller with root view controller as your view controller and then present navigation controller. Something like this.

let vc =  // your view controller 
let nav = UINavigationController(rootViewController: vc)
self.present(nav, animated: true, completion: nil)

Upvotes: 5

Related Questions