storyboard uinavigationcontroller does not allow me to drag items in - ios

I have an existing ios5/xcode 4.2 app, and I want a button to open a view that will display a list of items, and have a back button and an add new button.
I thought I could achieve this by adding a button to the main view controller, then dragging in to the storyboard a new UITableViewController, then embed a UINavigationController (editor->Embed In->Navigation Controller).
Then i right clicked on the button, dragged it to the navigation controller, and thought, ok this should work.
However, there is no back button, and xcode will not let me drag one in, nor will it allow me to drag in the button bar item "[+]" for the link to add new.
When I run the app, the list shows, of course I have no way to go back to the view controller with the button on it.
What am i doing wrong? - thanks.
(my question is similar to this
but for xcode 4.2)

Embed the main view controller, not the new one, in a UINavigationController. This should add a simulated UINavigationBar to the main view (if not, set one up under Simulated Metrics). At this point you should be able to drop in a UIBarButtonItem to the main view's simulated bar.
Next, draw a connection from your button to the new UITableViewController to set up a push segue. At runtime, the back button will appear in the bar automatically.

Make sure when you try and drag the items into your view controller that the storyboard is zoomed in. XCode won't let you add items if you are zoomed out.

Related

Dragging Bar Button Item to Navigation Controller fails

I am following a tutorial on Udemy about Navigation Controllers.
The instructions are to drag a Navigation Controller onto the storyboard, and then drag and drop a Bar Button Item on the right of its navigation bar to segue to another view controller.
However, when I drag the Bar Button Item to its would-be position on the navigation bar, no drop-zone gets highlighted, and the button gets added to a random tab at the bottom of the screen.
I have tried finding references to this problem but all solutions are programmatic and given the wysiwyg nature of iOS development I would like to solve it through XCode UI.
Is there some setup I must change or is this an XCode 7 discrepancy?
Try to add a ViewController and then in Editor -> Embed in -> NavigationController. Then it should work.
I have solved my problem by dragging the Bar Button Item into the Document Outline, below Root View Controller.
This automatically creates Left Bar Button Items and Right Bar Button Items, which gives you an opportunity to drag the Item in the section of the controller you like.

Create Modal View with Save/Cancel button

I'm pretty new to Xcode development (I'm using swift), and am building up my application flow in the storyboard. I'm attempting to create an "Add New" dialog in a similar style to that on the Calendar app.
In terms of structure, I have a UITableViewController that has a UINavigationItem on it (There is a UINavigationController before it in the storyboard. I have added a UIBarButtonItem with the Add Identifier, and created a Segue from it to a new UIViewController, using the "Present Modally" option to make the view appear in from the bottom.
On the "Add New" screen, I want to have a Navigation Bar at the top, with a Cancel Button, a Save Button and the page title (the same way the Calendar App Add Event view works).
Initially I figured I would just throw a UIToolBar item onto the page and create those items by hand. However, the apple standards seem to indicate that Toolbars should only ever appear at the bottom of the screen, not the top.
I can change the Segue to "Show", this causes the view to slide in from the right. It also sets the left hand button to a "Back" action (i.e. "
What is the apple-approved structure I should be using to do this? To summarise, I want to do the following:
Segue from the Add button on the List View to the Add View.
Animate the Add View in from the bottom
Display a Navigation Bar on the Add View containing three items:
Cancel (Far Left) - Returns to the Previous View (by sliding the view down)
Title (Middle)
Save (Far Right) - Performs a custom action (I can handle this myself)
You should present the "Add New" dialog inside another UINavigationController, even if you don't intent to push additional view controllers onto it once it is presented. This allows you to easily use navigation items again to show the buttons.

How to manually add a Back button to my NavigationBar?

I would like to know how I can add a back button to my UINavigationBar, I know that If I embed in a Navigation Controller in my main view, that all of this would happen automatically, but that is not what I am trying to do, in fact, the back button could go to any other view I connect the segue to, doesn't even have to be the back.
The back button needs to be the system navigation "back" button, I don't want to have to set image files for my buttons.
I tried dragging in a bar button item in storyboard but nothing shows up, doesn't seem to be doing the trick. The navigation bar was dragged to the view in storyboard (not created programmatically) and it shows up just fine.
I looked at the following similarly asked questions:
-> How do i add a 'back' button to a UINavigationBar manually?
-> How to add a button to UINavigationBar?
-> How to programmatically add a UINavigationBar and a back button on it
but they all point to just embedding the view in a navigation controller, which again, is not what I am trying to do.
If someone can please help me out, provide some sample code I would greatly appreciate it.
Try drag-drop a UIButton object. I have always added manual back button (hardly took the in-built one)

Xcode - How to attach a tab bar to a view without adding a tab for the new view

I have an application which has 5 tabs. I also have another view which you can access from tab3 via a selection of buttons. I will call it view 3b. View 3b populates with information based on which button the user selected in view 3. After the user puts in all the information required the app automatically takes them back to view 3. I want to add the tab bar to this view(3b) but I do not want it to have its own tab. I just want to use it so the user can navigate out of this view back to the rest of the app if they want to exit the screen early. Does anyone know how I can attach the tab bar to this screen without having a tab added for this screen. I am using Xcode 4.6.2 and am using storyboards to set up my app.
Any help would be appreciated. I've done a bit of searching but everything I find just explains how to use tabs.
Any help would be appreciated. Thanks.
It sounds like you need to use a UINavigationController.
When you set up your UITabBarController, instead of linking the third tab directly to your 3rd view controller, connect it to a UINavigationController, and then set the root view of that UINavigationController as the UIViewController you want as your third tab.
From there, you can set up your buttons to perform a push segue to your second view controller (view 3b from your question). If you do this, not only will you keep the tab bar on view 3b, but a back button will automatically be placed in the top left of the page so the user can simply go back to view 3. If you don't want the navigation bar that appears to be there, you can instead uncheck the "shows navigation bar" checkbox in the UINavigationController's attributes inspector.
I hope this helps!

Xcode - Change view using Navigation Bar Button Item and Storyboard

I'm making an app with multiple views, using a Navigation Controller. I can easily change views by ctrl-dragging from a button to another view, but it doesn't work by doing the same thing, but with a button in the Navigation Bar.
At first, I had a warning about the style of the button, so I changed it from Plain to Bordered. I have no warning now, but when I click on the button, nothing happens.
Thanks for your help!
Try it again but using a UIBarButton, then link the push action to it and it should work.
Right-click the button and drag the circle next to "Push" under Storyboard Segues over to the view you want the button to navigation to.

Resources