xcode/storyboard: can't drag bar button to toolbar at top
Solution 1:
I have got the same problem using Xcode6 and I noticed that UINavigationItem is added automatically for the first ViewController that you embed into NavigationController but for the subsequent ViewControllers, you will have to add it manually as follows:
- In the Object library, find Navigation Item then drag it to your 2nd ViewController in the storyboard.
- In the Object library, find Bar Button Item then drag it the navigation item that you have created in the previous step.
Now you will have your Bar Buttons stuck to the top of your scene.
Update The solution still works with XCode 7 but I wanted to add more descriptive photo. Just in case anyone is not really familiar with standard or technical names mentioned above. Notice the red arrows in the right, they refer to step 1, step 2 mentioned above. Also note the hierarchy of views on the left red rectangle.
Solution 2:
Nasty trick:
- Change your segue to push.
- Set the content you need
- Set back to show
Then the content will be editable and you have a non deprecated style for segue.
Solution 3:
Your storyboard's view controller is likely missing a Navigation Item
. You can drag one from the Object library, and drop it on your view controller.
You'll then be able to drag and drop bar button items onto the left or right side of the navigation bar.
Solution 4:
i Solved it. drag in 'Navigation Item' to your detail view. than you can drag in the Bar Button Item.
Solution 5:
The way that I fixed this issue was, instead of dragging a UINavigationController into the Storyboard and trying to add UIBarButtonItems to that, I dragged in a UITableViewController and then went to
Editor->Embed In->Navigation Controller
Which gave the same result as before except I could add UIBarButtonItems to both sides of the navigation bar with no issues.