Show tab bar on modal View - ios

On click button "Go!" show white View Controller.
I want show tabbar on white ViewController, but it doesn't show. How i make this correctly? Swift please, thanks.

Do this in firstView,so the firstViewController embed in NavigationController,then make a push segue,the tabBar will not dismiss.

You have to use navigation controller to see tab bar. by presenting modally you can't get tab bar in white controller.
Swift code:
let secondViewController = self.storyboard.instantiateViewControllerWithIdentifier("SecondViewController") as SecondViewController
self.navigationController.pushViewController(secondViewController, animated: true)

I think you are using wrong segue just delete old segue and add new segue this way by pressing control key:

Related

TabBar disappear when segue even NavigationController Swift

Well, I'm faced with misunderstanding.
I want my UITabBar to stay displayed when I make a segue from my History button (see picture).
My segue is on Show.
My view is embed in a UINavigationController that is root controller at my UITabBarController.
"Show navigation bar" is turned off on my UINavigationController.
And with all that, I have a grey screen on my segue and no UITabBar...
Thank you in advance!
Try creating a popup view.
In the storyboard remember to set the identifier for the view controller that you are going to. Then delete the segue.
let customAlert = self.storyboard?.instantiateViewController(withIdentifier: "view") as! yourViewController
self.addChild(customAlert)
self.view.addSubview(customAlert.view)
customAlert.view.backgroundColor = UIColor.white
Please make Segue kind as "Show". When select as "Show Detail", the ViewController is present over the Tabbar and hides it.

How to handle a view controller independantly in UITabBarController?

My app's root is a UITabBarController with 5 sections, each of them contains a UINavigationController.
I also want to add a chat feature in the app, that could be accessed with a rightBarButton present in every navigation bar of the app. I would like it to show a chat UIViewController on the screen, unselecting the currently selected tab bar item and without losing the navigation state of the five navigation controllers, even the one that was previously selected before tapping the chat button. What would be my best bet to do it?
Thanks for your help/ideas.
Step 1: In your storyboard add a ChatViewController
- Embed your ChatViewController in Navigation View Controller if you wanna have a navigation bar. Add a close BarButtonItem in your ChatViewController.
Step 2: Create a close Action in your ChatViewController and binding with BarButtonItem in the StoryBoard.
#IBAction func CloseAction(_ sender: UIBarButtonItem) {
dismiss(animated: true, completion: nil)
}
Step 3:
In storyboard, select the Navigation Controllers with the rightBarButton and choose Present Modally and connect to Navigation Controller of the ChatViewController.
You can go to the ChatViewController without losing the navigation state of any navigation controller.

Tab bar missing when a segue is added

So I have 3 VCs embedded in a navigation controller and a tab bar controller. However, whenever I add a segue from the 3rd VC to the 1st VC, the navigation bar and tab bar disappear from the storyboard. So I tried adding a segue programmatically on the 3rd VC swift file as such:
let collectionVC = self.storyboard?.instantiateViewController(withIdentifier: "collectionVC") as! CollectionViewController
let navigationVC = UINavigationController(rootViewController: collectionVC)
self.present(navigationVC, animated: true, completion: nil)
Unfortunately, with the added code above, the tab bar is still missing but the navigation bar is there. I hope someone could help me.
If I understood correctly your problem, you are using a UINavigationController and you are trying to go from VC3 to VC1, which means that you have a navigation stack like this:
VC1 -> VC2 -> VC3
If you want to go back to VC1, you can use:
navigationController?.popToRootViewControllerAnimated(true)‌​
You will still have your tab bar, your navigation bar and - most important - you won't create another instance of VC1. This is the correct - and easiest - way of dealing with a UINavigationController.

Instantiate View controller with its tab bar from unlinked viewcontroller

I have a viewController related to a Tab Bar Controller: the first one.
Clicking on a cell of its tableview, I'll show programmatically another viewController that's not linked to the first viewController with no segue (because of right reasons).
Now, my goal is to present/instantiate the second viewController related to the tab bar mentioned at the beginning of this question.
If I'll use this:
let vc=storyboard?.instantiateViewController(withIdentifier: "offerteView") as! SecondViewController
It'll be presented the mentioned viewController without the tab bar of course.
How can I solve it?
Embed the first view controller in a navigation controller and use its pushViewController function to show the second view controller.
let vc = storyboard?.instantiateViewController(withIdentifier: "offerteView") as! SecondViewController
navigationController?.pushViewController(vc, animated: true)
when using tab bars the view controllers are called on the basis of their Index and because of this the tab bars are still maintained and this can be done like this.
self.tabBarController!.selectedViewController! = self.tabBarController!.viewControllers[3]
where [3] is the index position of the View Controller.
or
self.tabBarController.selectedIndex = 1;
//Hope it was helpful. Happy Coding.

segue to the TabbarController

In my image, my first Tabbar is HomeViewController and the second Tabbar is CameraViewController.
What is the proper way to segue to the Tabbarcontroller? You can see the read line, I try to segue this but I
always get the back button in my HomeViewController and It display weird like not showing the navigation name.
In CameraViewController I hide the Tabbar for the use camera button. I try to use segue programmatically like this one.
[self performSegueWithIdentifier:#"sample" sender:sender]
but It doesn't work properly. Is this possible to segue to TabbarController?
You can't call
[self performSegueWithIdentifier:#"sample" sender:sender]
Because you're in TabBarController already. You could implement custom flow. By pressing "Back" button - just show TabBar and change selected tabBarItem for example…
update
used this
[self.tabBarController setSelectedIndex:0];

Resources