Navigation Controller with Show relationship - swift

I would like to SHOW the view when I click on a specific icon in the Tab bar. Currently the view is PRESENTED, not PUSHED. I can't access to properties via the main storyboard, I really don't know how to do it.

For presenting a controller, the segue type should be : Present Modally
For pushing the controller in navigation stack, the segue type is : Show

Related

How to add Navigation Bar Title on iOS 13 Modal Screen in swift

when I created the UITableViewController within Modal Screen, I noticed that code refused to show on Navigation Bars with Title in the Modal Screen, but Full Screen has shows it with this code.
self.navigationItem.title = "Tip"
Do someone know any tricks that allow adding that Navigation Bar Title or Navigation Bar needs in Modal Screen supports.
Let me know if you know about this, thank you for helps. :)
If you have a navigation stack with one or more view controllers and one of those view controllers (let's call it A) presents a view controller B modally, B doesn't belong to the navigation stack. It is displayed by A rather than pushed onto the stack by the navigation controller.
If you want to show a navigation bar with your modal view controller, you have 2 options:
1.Add a navigation controller before the view controller you want to present modally:
Navigation Controller 1 -(root 1)-> View Controller A -(modal)-> Navigation Controller 2 -(root 2)-> View Controller B
Or, you can install a navigation bar at the top of the modal view controller.
If you just want a navigation bar for the sake of displaying a title, use option 2, otherwise, if you need a navigation stack, use option 1.

How to navigate back from a navigation controller on the storyboard in xcode

I've got an initial view controller InitialViewController with a button "List" (and a few other random buttons).
Clicking on "List" segues to a UITableViewController that is embedded in a navigation controller. And that is all sweet.
But once the UITableViewController is loaded there is no "back" button to navigate back to InitialViewController.
I was just wondering what my options were. On the storyboard I've used a "Navigation Item" and "Button Bar" and i'll hook that up programmatically to navigate back.
I just wasn't sure if an unwind segue was an option or if anyone had better ideas.
Thanks.
The reason you don't see a back button when your UITableViewController is loaded is because it is the root view controller for the navigation controller that it is embedded in. As such, the NavigationController has no other view controller in the stack that it can go back to.
Instead of the TableViewController, embed your InitialViewController inside a NavigationController and that should add a navigation bar with Back button to your TableViewController.
If you don't want to show the Navigation Bar in your InitialViewController, you can hide it using the following steps:
In your storyboard file, select the InitalViewController
Open the Attributes inspector and set Top Bar to None
Hope this helps!

Xcode - Show segue from modal view controller

I am presenting a modal view controller with a tableView, and then want to perform a push segue when a cell is tapped inside the modally presented view controller.
I set up a view controller and a show (push) segue from the modal view controller to the new view controller, but when I call performSegueWithIdentifier, the new view is presented in a modal fashion (slides up) on top of the initial modal view, instead of coming in from the right.
Anyone know what's going on?
Thanks!
For anyone who has this issue in the future, I figured it out:
You need another navigation controller. So I perform a modal segue to a new navigation controller, and set the modal view controller as the root view controller of the navigation controller. I can then perform a show segue from the modal view controller to any other as normal.
:)
As of Xcode 11.4 (possible earlier) you can also just select the destination view controller and in the right inspector pane under the attribute inspector you have the option: "Transition style" and "Presentation" which will allow you to change from Automatic to Full Screen for example. That way you can overwrite that when you use "push" from a modally presented view controller, the segue will always present the next view controller modally.

How to add the default back button in the navigation view controller from storyboard or in swift?

Okay so I have one main view controller and then I added a navigation view controller from the 'Editor -> Embed In -> Navigation Controller' toolbar and then I segued from the first view controller button to the empty navigation controller scene because if I segued directly to the signup or signin VC the main view controller would end up having a bar on the top like the navigation view controller. But now i added an bar button item "Back" and segued to the main VC and the bar comes back with a builtin back button. So how can i add a default back button or any back button without having the main VC becoming a navigation view controller. Here is a link to an image: https://www.dropbox.com/s/1623a45v846ijn8/Screen%20Shot%202015-09-27%20at%2012.23.26%20PM.png?dl=0
The problem is that you have two navigation controllers when you should only have one.
You should make your initial view controller a UINavigationController, and set your previous initial view controller as the root. If you don't want to see the bar, just set the bar to be hidden on your viewWillAppear, and unhide it on the Sign In / Sign Up pages.

Associate tab bar item with navigation controller that displays the second view controller in it's stack?

I'm creating a Tab based application. One of the tab buttons displays a navigation controller when pressed. Which in turn displays the default root view controller associated with that navigation controller.
I want to allow the user to go backwards past the default controller that is displayed when clicking that tab bar button. Conceptually the "main" controller that is displayed when the user clicks the tab bar button would be the second controller in the navigation stack.
The reason I'm doing this is that the "back" controller is to be a kind of setting screen. Changing the setting would effectively make the "main" controller invalid and would need to be recreated. I know I could do settings screen as a modal view controller but when the modal controller is to be dismissed after the setting has been changed I would have to destroy the "main controller behind and rebuild it.
So my idea is to just pop the "main" controller off the stack to the settings screen and then once they have chosen the setting push a new instance of the "main" view controller onto the stack.
My two ideas were to implement this are:
Set the navigation controllers root controller to my "back" controller and push the "main" view controller on top. Then somehow override the tab bar button so that it always displays the second controller first, which exposes the back button in the navigation bar.
The other idea is to set the "main" view controller as the navigation controllers root , and then add a custom back button to the navigation bar which when clicked would somehow insert the "back" controller before the current one and then pop to it when clicked.
I've not been successfully with either of these approaches. I've seen over apps do this mainly Twitter apps where you can go back past the default controller that is loaded when clicking the tab bar item.
Anyone know how to do this? I would prefer to go down the tab bar button triggers the second controller in the navigation stack to be loaded by default.
If this is the apporoach you want to take, you could set yourself as the tabcontroller delegate and implement the method:
-tabBarController:didSelectViewController:
Here you can check if the selected controller is your navigation controller and then pop to the viewController you want.