19
votes

I can't solve this despite my best efforts. I also consulted the Apple documentation and several related questions here and still I have a mental block on this.

Using Xcode 6, I embedded a table view controller in a navigation controller and could set the title of the navigation bar in the table view controller, but not in the two view controllers that are connected to the table view via segues.

I did think there was a navigation bar on these two view controllers because after I embedded the table view controller in the navigation controller, it blocked out my topmost textfield in both. I repositioned that so that isn't a problem, but in storyboard I still don't seem to be able to click inside the navigation bar to add a title and now having added a navigation bar manually to test it out, I can see that there is only one navigation bar in document outline.

So do you simply have to set the title of the navigation bar programmatically or with an IBOutlet or some such? Doesn't seem like you can click into it in story board.

10

10 Answers

32
votes

I am pretty sure this is a bug in xCode... I have experienced the same issue and most of the time it was solved by restarting xCode.

** In addition you may be able to get it solved by doing:

Drag a Navigation item from the objects pane into the viewcontroller or tableviewcontroller. This seemed to work for me. I did notice that the navigation area was missing from the "Document Outline Pane".

I hope this helps.

11
votes

I had the same problem while following apple's swift guid. Dubble-clicking the "navigation bar" did nothing for me. How I solved it:

1: Select the "navigation item" from the document outline pane.

2: Open the attributes-inspector.

3: Select the title field and write the title here instead.

6
votes

I had the same problem. What worked for me was to select the controller that I couldn't set the title on, click editor -> embed in -> Navigation controller.

Then you should be able to edit the title and when finished, delete the navigation controller and reconnect the two original controllers.

The screen that was previously embedded should now contain the title you created earlier.

5
votes

Try to set title programmatically -> self.navigationItem.title = @"REGISTER";

2
votes

place this is your prepare for segue: [segue.destinationViewController setTitle:@"New Task"];

1
votes

Be sure to use a Relationship Segue, not a Manual Segue when embedding controllers.

1
votes

Connect your Navigation Item to your class (i.e. UIViewController), and access it's title programmatically by writing the following within your viewDidLoad:

navigationItem.title = "whateverTextHere"
1
votes

Update to this issue if someone else need it:

  1. Make a segue between ViewControllers
  2. Pick Kind option as Show(e. Push)
  3. Than change this Kind option on some deprecated - ex. Push
  4. Now you can edit your tittle and navigation items from storyboard
  5. Remember to change Kind option again on what you need.
1
votes

None of the answers worked for me.

This worked:

  1. Delete nav connection
  2. Ctrl drag a new nav connection
  3. Make it a show connection
  4. Now you can edit the title
  5. Delete the nav connection again
  6. Create the original nav connection type again

It seems that this is indeed a bug in IB 🙁

1
votes

You can also set the view controller's "title" property instead, which will automatically set the title of a navigation item or tab bar item.

By selecting the view controller in the storyboard, you can set the title under "View Controller" in the Attributes inspector (Xcode 9):

enter image description here