Tab bar not visible on coming back to selected item - ios

I am facing a strange issue with Tab bar controller. I have a tab bar controller in main.storyboard working fine. I have 5 different storyboard references for each item and I could see all 5 tabs and tab bar is working fine in the simulator.
On selecting the 3rd tab, there is a button in 1st view controller that pushes to second view controller, here I am hiding the tab bar in viewWillAppear. Then when I push to 3rd view controller, I am showing the tab bar again in viewWillAppear.
Now when I select some other tab item from 3rd view controller and come back to 3rd tab, tab bar is not visible even though i have written below code:
override func viewWillAppear(_ animated: Bool) {
tabBarController?.tabBar.isHidden = false
}

Finally figured out the issue. One of my view controller in storyboard had hide tab bar on push view controller enabled causing the tab bar to hide in my expected view controller. On unchecking it and handling all hide/show tab bar in source code itself, i am able to fix the issue.

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.

Present view controller from UITabBarController without tab bar showing

I have read multiple answers regarding this issue. The main thing indicated is to set hidesBottomBarWhenPushed to true, which i have done and is still not working for me.
So this is my storyboard layout.
So i present a TableViewController from my TabBarController, the view i present is the bottom left on the storyboard. With hidesBottomBarWhenPushed set to true, i expect the bottom bar to be hidden but this is not the case. It actually adds a new bottom bar and upon navigating back to the tab view a new tab bar is overlapping the original one. You can see this in the screenshots below.
So firstly the tab bar, we then select the filter icon on the top right, which triggers the segue to the next controller.
So now the next controller loads in. As you can see the tab bar is displayed even though i have set hidesBottomBarWhenPushed on the storyboard.
And now when we navigate back there is a new tab bar overlapping the original.
I don't have much experience with tab bar controllers, have i done something wrong with my storyboard hierarchy maybe. Perhaps each tab should have its own navigation controller. However my tab bar also needs a navigation controller.
Any help or suggestions is greatly appreciated.
In viewDidLoad of tableVC
self.tabBarController?.tabBar.isHidden = true
In viewWillAppear of the VC before the tableVC
self.tabBarController?.tabBar.isHidden = false

Why does my Navigation Bar disappear in Xcode?

I have a navigation bar on my Table View Controller. When I run the simulator and navigate from the menu via UIButton, the navigation bar appears on the controller. However when I navigate to another page using a navigation bar, then return to the Table View, the navigation bar disappears.
I provided a screen shot of my main storyboard.
The main storyboard from my Xcode project
You should create your segue to the navigation Controller, not to the tablet, that way, you will have your bar.

Present Modal for Image Select Erases UI

I have a very simple View controller below. The UI is literally just a single button with the tab bar at the bottom.
import UIKit
class ImageAdderViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
#IBAction func ButtonPressed(sender: AnyObject) {
let imagePicker = UIImagePickerController()
imagePicker.allowsEditing = false
imagePicker.sourceType = .PhotoLibrary
self.presentViewController(imagePicker, animated: true, completion: nil)
}
}
Once the select image from photo library is selected, if I click cancel or select an image it returns to the view. But the view is now empty except for the tab view.
Here is where my confusion begins:
This code works on an empty project with just one controller.
This code works when I segue to this controller from a different controller that has no tab bar at the bottom. At this point the UI with the button that we have segued to also has no tab bar.
This code does not work when I segue to the controller via a controller that has the tab bar.
All segues are push Show (e.g. Push) segues.
In short the same UIViewController works when segued to by one view but not when segued to by a different view.
EDIT 1 Specific Questions
How do I make the view controller work even when segued to by a view controller with a tab bar? Could the tab bar interfere with the presentViewController code?
My Guess
Somehow something from the previous controller with the tab bar is messing up the code on the viewcontroller with the load button, and that something seems to be entering with the tab bar when the Show occurs. How do I prevent this?
EDIT 2 More clarification
When I click cancel or select an image, the view controller that it returns me too is now empty. The button is missing. When I add labels to the view, all added those disappear as well, and it is just white, except the tab bar at the bottom. This does not occur if I segue to the load image view controller from a view without the tab bar.
EDIT 3
The View that does not bring the tab bar with it when segued from, is not segued to via a navigation controller.
The View that does bring the tab bar with it when segued from, is segued to via a navigation controller.
The Former view functionality does not cause the error. But it does not bring the tab bar
The Latter functionality has brings the tab bar and I want that.
EDIT 4
Changing the segue to a modal present on the UI which has the tab eliminates the tab bar but does not solve to UI deletion problem. This means that merely the presence of the tab bar is not causing the problem.
EDIT 5
If I completely delete the navigation controller in the storyboard it all works, but the tab bar is gone. How can I make it work with the navigation controller?

Why doesn't my Tab Bar show up in the simulator?

I have a tab bar controller that controls 4 view controllers. When I run the simulator, the tab bar doesn't show up. I created the tab bar controller in a single page application by dragging it from the object library, then creating segues with ctrl-drag for views that had already been created.
I do not have a navigation controller.
The problem was that I did not have the Tab Bar Controller selected as Is Initial View Controller in the Attributes Selector. After checking this box, the tab bar showed up at the bottom of the simulator.

Resources