Show UITabBar on UIViewControllers that are not part of the UITabBar? - swift

I have an iOS app written in Swift with UITabBarController with 5 UIViewControllers. Now, I have a bunch of UIViewControllers that are not part of the UITabBarController. I'd like to be able to show that same tabbar but I have no idea how to do that. Any clue?
More details: This is one of the View Controllers that the tabbar has. I use storyboard references and split my view controllers into separate more manageable storyboards.
So, the big picture:
There's no initial ViewController since I use storyboardId to get to the initial Navigation Controller. From there we have a ViewController embedded in the same Navigation controller. In that ViewController, there are 2 Container views - one of the size of the bottom ViewController that contains the "hamburger" button that toggles the other Container View which has an embedded UITableView in. When a specific cell is selected it should go to Profile ViewController that's not even in the same storyboard. The segue is set to be Push. Either way, doesn't show the UITabBar on the Profile ViewController

how you doing?
I don't know if I understood, but you are trying to show tabbar after going to another screen, right? If the answer is 'yes', try to change your segue to show(e.g. push).
-----Edit-----
You can do with two ways:
Presenting Modally -> using Current Context
Use push(e.g.) with a navigation view controller, you can also hide the navigation bar if you go to Navigation controller -> Attributes inspector -> Navigation Controller -> Uncheck Shows Navigation Bar
Hope now it works!
Best regards

Related

Is there a way to show UINavigationController in the second storyboard if that UINavigationController in the first storyboard?

I have the first storyboard has UINavigationController its continues to the second storyboard but it doesn't appear there only when running the app.
I link between storyboard by (Storyboard Reference)
The first storyboard
The second storyboard
The UINavigationController doesn't appear in the second storyboard its appear only when running the app.
according to navigation controllers property it will not show the navigation bar in your case , if you want to edit or customise navigation items or navigationbar then you have to make changes programatically .
but to make changes in navigationbar or navigation items there is some limitations sometimes you can't fully customise it and sometimes you customise it depend on your requirement ... :(
I suggest you that use navigation property but hide the navigation bar
and on place of navigation bar (on top of every view controller) set a
view which will look like navigation bar and you can easily customise
it as per your requirement .
This is normal behaviour of the Storyboard as the controller in your second storyboard does not know if it is a controller in a navigation controller, hence it does not show the navigation bar. If yo want to show the navigation bar in the storyboard you can select it in the Simulated Metrics in the Attributes Inspector (shown here in that thread). You can see it working by giving the controller a title for example.

Unhide tabbar when a new view is pushed

I have UITableViewController embeded in a UINavigationController in my app. When a row is selected it pushes a UITabBarController. So far so good. The problem is that some of the tabs I push more views but the tab bar gets hiden. I've tried setting hidesBottomBarWhenPushed = NO, but it doesn't work.
I'm using XCode 4 with storyboard
Any ideas?
I've had this problem in one of my apps (though it was in iOS 4.x, using nibs not storyboard).
What I did to solve it: You want to have the root controller for each tab (the one with tabitem, etc) be a navigation controller - and when you push new views onto this navstack, they will respect the top navigation bar and bottom tab bar (they may actually display two navbars, so you have to be careful, but generally this is the way to go.)
first of all you might want to take a look at this
viewController: The view controller that is pushed onto the stack. It
cannot be an instance of tab bar controller.
so pushing an instance of tab bar controller is not recommended. There's a good reference there that might accomplish the task you wanted ill just provide the link here

Custom UITabbar

Is it possible to have a UITabBar in such a way that the following things are possible.
Once the app opens, none of the Tabbar items are highlighted (not even the first one). (call it homeview)
if the first Tabbar item is selected it goes to the first view and so on.
Hide the UITabbar for certain Tabbar items.
Allow any subview to go back to homeview.
Any tips on how to go about doing this will be appreciated.
Thanks
I had a similar thing to do:
start with a navigation controller
at some point show an UITabBar with multiple controllers
from some controllers from the UITabBar continue the main navigation controller
from any controller go to the home view (on logout)
For this to work I pragmatically created the UITabBar and pushed it on the navigation stack and from the controllers in the UITabBar I pushed other views on the stack.
To navigate to the root controller you can use this:
[self.navigationController popToRootViewControllerAnimated:YES];

UINavigationBar with TableView and Segmented Control inside UITabBar

I have a tabbar application. Second tab had a drill down table list with Navigation Controller. I also want to implement a segmented control inside a tool bar that shows different table entries as per the selected switch in segmented control. I am a little confused as to how to implement this?
Screen-shot -
This is the view in second tab controller an instance of the generic UIViewController. Blue Background is a UIView that contains a segmented control (1,2,3,4). The steel blue navigation bar at the top is a simulated UI Element from Interface Builder. I need to put a navigation Controller such that it has a list table view that changed depending on the switch selected in segmented control UI.
I have following options
Add UINavController as root controller for second tab directly with table view inside it. In that case how do I accomodate the UIToolbar having segmented control?
I add UISegmentedControl as part of the view of Second Tab's view controller and add navigation based table view as another element to that view. Is this doable? How can I add a nav based controller to a UIView and control the frame so that it does not cover the UIToolBar.
I hope I am making sense. Please lemme know if you have any suggestions. Thanks.
This is how I achieved it. In IB, in MainWindow.xib where I have a tabbarController, I made the class identity of the second tab to a UINavigationConrtroller. Then I made the main view Controller for second tab that had the segmented control and the Table View as a rootViewController to the NavigationController. This functioning exactly as I wanted. Thanks all for your help.
you can add UINavigationController in place of UIViewController in UITabbarcontroller and Put your UIViewController who haveing UISegmentControl in UInavigationController who add in UITabbarcontroller
in reading its looks confusing but try to implement its work
Step 1: xcode-->new Project-->tabbar application
Step 2: open xib of main window select tabbarcontroller and open inspector. in that you able to see list of view controllers change their class to uinavigationController.
if you need uinavigationController in second tab then change only secong tab class to uinavigationController
step 3: create new uiviewcontroller. open its xib and add uitableview and segment control to that.
Setp 4: now expand tabbarcontroller and check your second tab have navigationcontroller now add your uiviewcontroller in navigationcontroller's viewcontroller
According to your requirements you can't avoid working with code - I mean that you can't set everything by connections in IB.
I would create a UIViewController (let's call it container) that will contain the segmented control and the navigation controller.
You should set the second tab to be a view controller and point it to the container.
Container's view (XIB if you want) should contain the segmented controller that will be aligned to bottom and a containerView that will fill the rest of the view and will have its IBOutlet.
Container should also have a navigation controller member that will be initiated in viewDidLoad.
The table view that you talk about should also be built in its own XIB and have its own view controller that will be set as root view controller to the navigation controller...
Tell me if it's too confusing / complicated...

Can a UINavigationController contain a UITabbarController?

I want to have a UIView inside of a NavigationController that has 4 buttons. Clicking on any of these 4 buttons will push a UITabBarController that contains a NavigationController with a respective UIView.
Is this possible? Tweetie seems to do something similar.
On my application, I have a tab bar view controller, then inside of that, I have navigation controllers going to individual views in my interface builder. I believe if you just copy this format, it will work.(-> means connected)
Tab Bar View Controller->4 separate Navigation Controller->ui views
I hope this helps