10

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:

  • Selecting the controller in storyboard and going to attributes inspector and ensuring that top bar is set to Translucent Navigation (didn't work)
  • In the viewWillAppear function, I wrote: (didn't work)

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

2
  • 1
    How do you present the view? Commented Jan 11, 2016 at 10:31
  • 1
    please clarify what you are asking... Commented Jan 11, 2016 at 10:31

3 Answers 3

13

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

Sign up to request clarification or add additional context in comments.

4 Comments

that leads to a loop whereby the view controller is populated repeatedly (leading to a crash probably).
It shouldn't. The only thing you did is embed your VC in a Navigation Controller. AFAIK, this is the way to do it though.
it worked. The issue was that I didn't remove the code suggested by another user. Thanks a bunch
I don't think this actually works. It adds a UINavigationBarItem, not a UINavigationBar
5

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)

4 Comments

I have tab bar and one of them is order tab...so when I click it, the first picture above is loaded (the view controller that is)
"the first picture above is loaded (the view controller that is)" is it a tableViewController ?
@ksa_coder can't see picture. might be stackoverflow issue
well I think others see it...sorry can't do much about it
4

You have to embed your UITableViewController in a UINavigationController.

1 Comment

This is the best solution if you are using Storyboard. But if your UITableViewController is in a xib, then use the above solution from hellosheikh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.