0

I'm developing a (so far) simple iOS application using storyboards.

At one place in the storyboard, I have:

Navigation controller -> Table View (prototype content) -> Regular view

The "regular view" is accessed from a + (PLUS) button in the navigationbar in the table view. In the "regular view" I would like to have a save button in the NAVIGATION BAR. However, when I drag it from the object library to the "regular view" it appears in the TOOLBAR (at the bottom of the screen) instead of in the NAVIGATION BAR. I have not found a way to move it, or found any settings where I can change it. I'm not sure if there is something constraining me from putting a button there or if XCode just mess with me. (I'm new to iOS programming)

Notes:

  • In the "regular view", I have a back button and a title. According to the design guides I should be able to have one more button.

Thanks for any help!

Code cracker
  • 3,105
  • 6
  • 37
  • 67
Joakim
  • 3,224
  • 3
  • 29
  • 53
  • I faced this problem before and now set UIBarButtons programatically like this: `UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self.parent action:nil]; [self.navigationItem setRightBarButtonItem:cancelButton];` – atulkhatri Mar 25 '15 at 09:46
  • I want to set the buttons from the interface builder as much as possible, but thanks! – Joakim Mar 25 '15 at 09:47

2 Answers2

0

If anyone faces this problem, I did the following:

I couldn't add a Bar button because there were no top bar in that view. First I tried to put a Navigation Bar in the view, but Xcode crashed. Then I tried to put a Navigation Item, which worked. After that I could place my bar button in the top bar.

What I don't understand is why I could put the Add (+) button in the previous view, since that doesn't have any navigation entry either, but I'm guessing it's since that view was the root view controller of a Navigation Controller. Someone else can maybe give a more detailed answer.

Joakim
  • 3,224
  • 3
  • 29
  • 53
0

There isn't any solution for this so far. There are however some workarounds for this problem.

Check this pretty cool answer by @Shimanski: https://stackoverflow.com/a/20419513/2082569 & also this by @ecotax: https://stackoverflow.com/a/17019667/2082569

Community
  • 1
  • 1
atulkhatri
  • 10,896
  • 3
  • 53
  • 89