Why doesn't "Navigation Item" show up in one of my ViewControllers in Interface Builder? - interface-builder

I have some working navigation between ViewControllers, using a UINavigationController.
But if you look in the image, you'll see my ViewControllers in InterfaceBuilder have an item called "Navigation Item" which showed up when connecting it to the UINavigationController.
However, the TutorialViewController doesn't have this. How do I get it to show up? I tried copying the Navigation Item from one controller and pasting it into another, but that didn't work.
The really weird thing is that if I use the button on the front page to go to the Tutorial page, the navigation works, shows a back button and everything.

Just drag & drop a Navigation Item from the object library onto your ViewController in InterfaceBuilder

Related

In Xcode, how do I create an outlet for a button that is inside a container?

I'm a total newbie with xcode and swift, trying to wrap my head around ios programming.
I'm designing a storyboard for my app. The storyboard uses containers to keep track of the controls. In one of the containers resides a button. I want to create an outlet for it to add some code when it is clicked.
If the button would be on the base viewport of the storyboard, I would control-drag a blue line from the button to the source window with my UIViewController subclass file, and it would assist me in generating the code. But for some reason when the button is in a container, this just doesn't work.
When following the documentation, it says to open the assistant editor when the button is selected and it should open the relevant file. So it open an objective-c file, but when I try to control-drag into it, it informs me that I do not have write permissions. Also I feel like I should be doing it in a subclass instead.
I have searched online a lot and tried everything I can think about, but nothing has worked so far. How does this work? Can I do it programmatically or so perhaps? I hope someone can straighten out this question mark...
A container view is intended to represent an area that will host a view from a different view controller that becomes a child of the view controller that owns the container. Usually, you would create a second view controller, link your container view to it using an "embed" segue, and then put your buttons and such in the second controller's view. The code behind those would then go into the second controller.
If your purpose is simply to have superviews to control layout within a single view controller, use a UIView rather than a container and the problem goes away. That's what the Editor->Embed In->View menu item is for.

Xcode osx scroll view

I am going round in circles trying to get a custom view to scroll correctly.
To simplify this.
I create a new OSX cocoa application.
Go to the xib file, select the window. drag a custom view, then drag a few buttons into it.
Run the program, you have a button in the screen.
Now go back the custom view, select editor -> embed in -> Scroll view
Everything looks fine, and suggests you will have two buttons with scroll bars in the custom view.
Run the program, the custom view shows with scroll bars, but the button do not show.
What am I doing wrong?
Following your instructions I have created and changed the project. No problem.
Run in IB your "app", CMD R. The user interface itself can be checked in this way.
If problem remains
Check the layer position->Click on the custom View
Is it possible to Layout->Send to back? If yes, then your button-scrollview is not embedded.
Unembed the button, view and repeat the process, by checking in IB if now the interface shows appears correctly.

NAvigation bar doesn't appear

I'm developing a storyboard app with UITabBarController.
I want a UINavigationBar on one of the tab ViewControllers. I set the property Black NavigatonBar in ViewController property, and also drag navigationItem to this view.
NavigationBar is not visible in the viewVontroller when I run the app
It sounds like you're changing the pop up in the simulated metrics inspector. That inspector allows you to tell Xcode about things that will exist in your app that don't exist in the storyboard.
It sounds like you want to add a navigation controller into the storyboard to wrap one of the view controllers in your tab controller. You can do that in the editor menu by choosing the "Embed in" menu, and then choosing "Navigation Controller".
Choosing that item will insert a new navigation controller, make the selected view controller the root of the navigation controller, and re-route any segues that used to point at the selected to controller to point at the navigation controller instead.

How do I add an "add" button to a tab in a uitableviewcontroller within a uitabbarcontroller?

xcode 4.6
using Storyboards
When I drag a Bar Button Item to the navigation bar at the top of one of the UITableViewControllers that are children of the UITabBarController xcode creates a new navigation bar at the bottom of the page instead of adding the button where I dropped it. I would be ok with this, but when I run the app the bottom navigation bar never shows up, so my button is never displayed.
If you need to visualize the app, picture the following: Root controller displays a list of accounts. When an account is clicked a tab controller lists tabs for opportunities and contacts. I need the ability to add opportunities and contacts from the relevant tab
Any help is greatly appreciated.
EDIT
I am not sure if this is the correct solution or not. I have embedded the uitableviewcontrollers in navigation controllers, which appears to have fixed the problem.
Follow-up question - Is this the correct way to handle this situation?
Yes, that is the correct way to handle this situation.
You should embed the view controller inside a navigation controller by clicking the view controller in your storyboard and using the Xcode menu "Editor" > "Embed In" > "Navigation Controller".

XCode, Storyboard, View Controller items are not being displayed

When opening up a project today, there is some weird behavior in XCode. Things have disappeared in the storyboard view like the NavigationBar in viewController, the buttons associated with it, etc. I can see in the Scene list that they still exist. Is there any way to have these show up again?
You probably need to add a navigation controller to your storyboard and make your view controller the root. You cannot simply set the top bar in simulated metrics in storyboard to navigation bar.

Resources