I am new to iOS development and have not tried this programmatically yet. I would prefer to get this working in a storyboard.
I'm following this somewhat outdated tutorial from XCode 4.5 in XCode 6.1 to create a series of views connected by one navigation controller.
http://youtu.be/rgd6mCuzlEc
Once I create the second view controller, I am unable to double click the navigation bar to change the name and I am unable to add a bar button to it.
I have a Segue going from bar button "Item" from view 1 to 2. Notice in the "View Controller Scene" there is no navigation item. If I add any elements to the view controller they fall under "View" and not under "View Controller", unlike view controller 1 where it falls under "one".
Is this a limitation on XCode? Am I using the wrong Segue (Show)? Is there a hidden setting or customization I'm missing?
I actually have this working for 2 view controllers and failing the 3rd in a separate project but I don't know what I did to do that so I'm pretty sure it's possible I just cannot reproduce..
EDIT: Workaround Instead of the new adaptive SHOW segue, use the deprecated PUSH segue, add the bar button items, then change back to the adaptive SHOW segue.
Try adding a Navigation Item to the controller and it should work properly
Related
I use Xcode 9.2 and iOS 10.x.
I would like to refactor my large main storyboard to smaller ones.
My initial login scene is embedded in a navigation controller, so all other consequating scenes are in the navigation stack and I have created view controller titles and navigation bar buttons to them.
After refactoring a branch of my scenes that are related to staff management to a new storyboard, everything has been moved correctly and links between storyboards created and the application still working as expected. I did the refactoring using Editor-->Refactor to Storyboard...
However, when you go to the editor of the new Staff storyboard you will notice that all navigation headers and buttons are missing, although working. For example, in the first scene I have a title and in the 2nd screen of the stack I have several nav bar items. All of these are missing in editor but appear when I run my application.
Does anybody knows how I can make navigation items visible again, in my new Staff storyboard, in order to edit them further e.g. add new buttons etc. ?
Is there any fix to all of this or is it a normal feature of Interface Builder/Xcode?
An oversimplified "version" of this issue could be recreated as follows:
1. you have just one view controller A embedded in a Navigation Controller.
2. you add navigation items / nav bar buttons in the navigation bar
3. you remove the navigation controller and as a result you loose in the editor any buttons
I'm rewriting an Obj-C project using Swift 4 / Xcode 9.2
I have a large storyboard that I am breaking down into multiple storyboards. I did this previously without any issues. If I refactored a few views to their own storyboard then the views took the navigation item with them. now they disappear...
[
My questions are ...
Is this an Xcode bug? or a new feature?
Obviously you can work around this as I have shown in the pictures but is there a way to stop the vanishing from happening?
This is the way it's always been. In your storyboard, if a view controller is not a child of a navigation controller via root view controller or push segues, then by default no navigation bar is shown in the storyboard. You can force it on, though, by going to the Simulated Metrics section of the Attributes Inspector tab and selecting one of the navigation bar options for "Top Bar".
Your view controller is no longer a child of a navigation controller, so it no longer automatically has a navigation item. If you need it to have a navigation item, drag a Navigation Item from the Object Library onto it. You will then be able to give the navigation item a title, and drag buttons and so forth onto the navigation item.
I'm new in Objective-C, and even more using storyboards. This being said I'm trying to use a bar button item within UITabBarController and UINavigationController as can you see in the image below.
But once I run the project in simulator this item is not showing. I would appreciate a non programmatically solution if it's posible.
Okay, so the way to do this:
When you create your tab view controller. You have to add a navigation controller that will handle each tab.
Tab View Controller --> navigation controller --> View Controller 1.
Then add the bar button item to view controller 1. Then go ahead and add the segues.
Now, still it won't show up.
But, if you go to your code for your view controller 1: Add a reference from the storyboard of your bar button item into your View Controller 1 file. Then, in ViewWillAppear():
self.tabBarController.navigationItem.rightBarButtonItem = _btnNewContact;
From there, it will show up and the segue you have configured in your storyboard should work perfectly! =)
After I spent a while trying to get the best way to do it I finally did that I should have done since begin. Read official apple documentation.
Parameters
viewController
The view controller that is pushed onto the stack. This object cannot be an instance of tab bar controller and it must not already be on the stack.
In other words, my approach is just a bad design.
There are 2 View Controllers in my storyboard, VC_A and VC_B
I have embeded a navigation controller in VC_A which is a Table View Controller, I then control drag the Prototype Cell into VC_B to create a segue. If I select "show" in "selection segue" then in VC_B I can see the outline of the navigation bar but I am unable to select it or add any bar buttons to it, it also doesn't appear in the hierarchical view.
However if I select the "push (deprecated)" option when choosing the type of segue, I am able to select the navigation bar in VC_B and add buttons to it, it also show up in the hierarchical view as a Navigation Item.
The only work around I can find is to choose show, then change the segue to push(deprecated) in the Attribute Inspector so the Navigation Item will show up in the hierarchical view, then change the segue back to show. But I am worry that this might cause problems further down the line.
Is there a way to add a Bar Button to VC_B's navigation bar without using the work around?
Just drag the "Navigation Item" from object library to the navigation bar and it should work as expected. You can make changes as you like and it works exactly like in Xcode 5.
Interestingly, when you first time made the connection b/w your table view controller and view controller using Push you can start editing the navigation bar without a problem (e.g put bar items onto it).
Then delete the connection between your table view controller and view controller (but do not delete the nav bar items you just added), then re-connect the two controllers by using segue Show, you will see the navigation bar works just like segue Push now.
Hope it helps
I think the way you do it (going through the deprecated push) is not wrong even though there's another way. In fact, when you turn the Segue into a push, you get a Navigation Item out of it.
So all you have to do is add a Navigation Item to your View Controller and that'll do the trick:
This seems Xcode bugs.
In my case, i am re-create segue by this sequence:
Delete existing seque. (I am using "Action segue - Show")
Drag new segue with "Non-Adaptive Action Segue - Push (deprecated)"
Delete segue no.2
Re-create/connect "Action Seque - Show". (No.1)
Done
Now, i can edit navigation title and add custom navigation item button as usually.
I am using Xcode 6.4, and minimal target iOS version 7.
In your viewController :
self.navigationItem.title = "Second VC"
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Play, target: self, action: "playFunction:")
I would like to create the following navigation
I have a tab bar program build with storyboard
and I have a View controller with buttons
when I click a button A navigation controller is called
Right now I have made all the connections and everything works fine but..
in order to create the change from the button to the table view I am using modal segue and that removes my tab bar.
I know that push will not work cause its not a navigation but how can I work this out?
I had the same problem but I realized that the best option is do it using a push segue. It's the best option because when you have a table view into a tab bar item it's more usability, it's what customer want. I'm sorry for not solution your problem but I strongly recomend you to use push.