Pop view segue in Xcode - ios

I have 2 UIViewControllers with their own navigation bars, but they're not embedded in a Navigation Controller. I want the bar button item of the first view to push the second view, and a bar button on the second view to pop the view, showing the first view underneath.
I've added a show segue from the first view to the second one in my storyboard but I can't find a pop segue when I try add a segue between the second view's bar button back to the first view. Here's what my storyboard looks like:
How would I make the back button on the second view pop itself to show the first view?

Related

How to present another view controller under tab bar on button press inside a tab bar controller view?

I have 4 tabs and in the home tab, I have a button to goto profile view controller.
When I use segue, The view changes completely and it's presented over tab bar. So it gets hidden.
I want to present it under the tab bar so that I can quickly navigate to other tabs without a back button.
I am not sure if this is the right way or not. but you can add presenting viewcontroller's view as subview with the same animation.

Why Do I Need A Second Navigation Controller?

I have the following on my storyboard:
A navigation controller with a table view controller as its root view controller.
The table view controller's navigation item has right bar button (Add) that segues to a 2nd navigation controller.
The 2nd navigation controller has a 2nd table view controller as its root view controller.
The 2nd table view controller's navigation item has a left bar button (Cancel) and a right bar button (Save) both of which unwind back to the 1rst table view controller.
This all works fine: I can navigate from the 1st table view controller to the 2nd and back.
If I remove the 2nd navigation controller and instead segue directly from the 1st table view controller to the 2nd then the 2nd table view controller's navigation item is not displayed. What is going on? Why do I need the 2nd navigation controller?
remove the intermediate navigation controller and connect your second VC to initial vc and change your segue type kind model from present modally to show e.g push
if you are using present then navigation controller is not a manodatry but on your save and cancel button purpose you need to embed with navigation controller, in here you push then no need of Second Navigation Controller.
on navigation use
[self performSegueWithIdentifier: #"sample" sender: self];
on your second by default navigation bar will comes, if you need add barbuttons in right and left side, once press the done button use the following comment
[self.navigationController popToRootViewControllerAnimated:YES];
it automatically come back to initial VC,
you can get the detail of segues in apple
You don't need a second navigation controller. This is what you need to do to after you do a Show segue to the second TableViewController:
Confirm that you're actually doing a Show (e.g., Push) segue. If you have to do a Present Modally segue, then you will need another UINavigationController.
Add a Navigation Item (not a Navigation BAR) to the second TableViewController. You'll then be able to add a title, add navigation buttons, etc.

Adding buttons to navigation controllers

I am working in a swift 3 xcode 8 project, and I have an issue.
I have some view controllers.
In the first one I've inserted a navigation controller, which gives me the "back" button when I am in another view controller. So I can go on and back to the first viewcontroller.
The thing is, lets say, when I am in the third view controller I'd like to insert a button, but appearing just in this viewcontroller in the navigation controller.
I've tried adding a bar button item but it doesnt work because the navigation controller only appears, in the storyboard, in my first viewcontroller.
So how can I add buttons to the navigation controller, in another viewcontrollerS?
So how can I add buttons to the navigation controller, in another viewcontrollerS
Drag a Navigation Item into your third view controller. Now you can add bar button items to that.

Navigation Controller Embedded in Tab Controller - Tab Bar not visible

I have a Tab Bar Controller with 3 views embedded in it : 2 are normal ViewControllers and one is a Navigation Controller which has a ViewController with a CollectionView as in the picture below. Now when I first enter the Tab Bar Controller and navigate between the tabs, everything is fine.
If I press any object in my collectionView, a new view gets pushed onto the navigationController. The problem occurs if I then press the back button and pop that view in order to return to the view containing the collectionView. In this situation, the tab bar on the bottom of the screen becomes invisible.

(iOS) Why does second 'push' segue in navigation controller always crash?

I have a storyboard setup as a Tabbed Application with first view controller containing a
UITableView. The Protoype cell has a "push" segue to detail view which is embedded in a navigation controller. So far so good. The detail view pushes when a cell is selected and there is a navigation bar item to get back to the table view.
Now I run into trouble. The detail view has 2 buttons "Map" and "Ticket". If I create a new UIViewController, embed it in a navigation controller, and ctril-drag a 'push' segue from a button to the new view controller as before, the app crashes instantly with a SIGABRT when I click the button. If I don't embed in nav controller and use a 'modal' segue instead it doesn't crash but it seems a natural flow to continue with the 'horizontal slide' animation and the nav bar button back to the detail view.
Once I can stop that crashing I would like to connect the other button to it's own view controller with a UIMapView.
What am I doing wrong?
You don't need to embed a navigation controller in the detail view. You only need one at the top level. Take out the navigation controller in the detail view controller and just do a push from there to the next view.

Resources