ksa_coder
ksa_coder

Reputation: 1403

Swift - UITableViewController with navigation bar

I am facing an issue with one of my table view controllers. I don't seem to be able to get the navigation bar to show on top no matter what option I enable (maybe I am missing something).

I tried the following:

self.navigationController?.navigationBarHidden = false

Attached is also an image of the controller discussed. How can I do show the top bar? otherwise the results are ugly since the records showing (rows) are starting from the very top. I do not wish to use UIEdgeInsetsMake to fix it if possible.

enter image description here

and

enter image description here Thanks,

enter image description here

Upvotes: 10

Views: 14532

Answers (3)

Ted Huinink
Ted Huinink

Reputation: 856

Click the ordersViewController. Then in the top bar Editor > Embed In > Navigation Controller and remove the navigationbar you currently have in the VC.

Upvotes: 13

hellosheikh
hellosheikh

Reputation: 3015

If you are coming from another controller to TableViewController then

try this code

let nav : UINavigationController = UINavigationController(rootViewController: self.storyboard!.instantiateViewControllerWithIdentifier("YourControllerName") as UIViewController)

self.navigationController?.presentViewController(nav, animated: true, completion: nil)

Upvotes: 5

msalafia
msalafia

Reputation: 2743

You have to embed your UITableViewController in a UINavigationController.

Upvotes: 4

Related Questions