I have 3 View controllers in a tab bar. (my 3 icon). I have another view controller that is accessible from one of the 3 via a button. I do not want this extra view controller to show on the tab bar though.
On clicking the button with a push segue nothing happens, with a modal segue it opens the new page, but the tab bar disappears. (Even though I created a relationship from this new view controller to the tab bar).
How do I get the tab bar to remain? I don't really want to set up a navigation controller between my one view and the other (not on the tab bar) because it's not really hierarchal content.
Is modal actually the right segue to use?
Does your views (the views of the 3 views controller) contain the tab bar? If not, you may try transiting from the view to the view of the extra view controller.
see +[UIView transitionFromView:toView:duration:options:completion:]
When you select a Modal segue, the new view is not added as part of the current TabController stack. That's why the tab bar is not visible when you go to this view, and it's why a Push segue does not work for you (you can't push a VC that's not part of the stack).
From the sounds of it, if you want the tab bar to remain visible/useful but don't want to add this VC to the tab bar, what you're really saying is that this VC is a sub-view of one of the original 3 VCs in the tab bar.
In which case you could manage instantiation of your "custom" VC from within one of these original VC's, and add it as a sub-view?
For example if you've got: Tab1, Tab2, Tab3 and ExtraView
in Tab2 VC you would init/alloc SubView and do: [self addSubView:ExtraView.view];
Unfortunately, of course this way you lose Segues, but unless you want to go ahead and set up Tab2 as nested NavigationController in Storyboard, I think that's your best bet.
Related
I have a tab bar controller that points to several story board references.
One of the references points to a story board (SC1) with two view controllers. On VC1, the tab bar appears, yet on VC2 the tab bar does not when I segue to it programmatically. Perhaps it's more accurate to say the tab bar items don't because a light grey bar does appear to be at the bottom of the view.
I have another story board (SC2) with a similar setup yet the tab bar appears on both VC1 and VC2. In this case I segue by clicking on a tableview cell.
In both cases I segue from VC1 to VC2 using a Show (e.g. Push) segue.
it needs to be created as a relationship to the external storyboard reference. the storyboard's VC you'll be referencing must have a tab bar item in it to show app. Plus you can also try create a tab bar controller and add them in code (I have done that in the past).
The issue was a lack of understanding of Tab Bar Controller and the relationship with Navigation View Controllers.
I assumed every child vc embedded in a Tab Bar Controller would display the tabs. In other words..
Tab vc
...vc1
.....vc2
Tab vc only sees vc1. The answer is in the Navigation Controller.
The first vc must be embedded in a Navigation Controller. That vc and all other child vc's go onto the Nav Controller stack... When you call it, every child vc knows that it is embedded in a Tab Vc and will display the tabs.
I have a main screen that is a Tab Bar controller with 4 tabs. One of the tabs takes you to a navigation controller where you can click through 3 different Table View Controllers.
I also have a button on one of the other tabs. I would like this button to take the user to the end of one of the Navigation controllers.
I can perform the segue just fine, but when I use the button to get to the View Controller, the tabs on the bottom aren't there, it's just a table.
Is there any way I can segue to a View Controller within a Navigation controller from outside the navigation controller and still have the tab bar showing?
Here are some pictures of what I mean:
See how at the bottom of this page there is the tab bar still? This is when you get there from the navigation controller
And in this picture, there is none (This is the friends page, same as picture above). I arrive at this by using a segue from a button from one of the other tabs.
Please let me know if I need to be more descriptive but I can't figure out how I can make this happen. Thanks for the help!
So I have this application where I have a view controller (which I want to appear first when the app starts) and a tab bar controller. I also have other navigation bar controllers that are in the tab bar controller. I want to place my view controller on top of the tab bar controller. Making the tab bar controller the parent of the view controller would be better though.
But take note, I do not want a tab bar item to represent the view controller and I want the tab bar to appear along with the view controller. I do not and would not want to use storyboards as much as possible. How can i achieve this?
I guess the simplest solution would be to use a screenshot of your tabBar and put it in your HomeViewController as a button. In this case you could use your HomeViewController as rootViewController and in the button action you set the TabBarController as the rootViewController.
Root = Home + Button
-->
Root = TabBar
Perhaps you need four buttons, if you want the correct tab to be selected.
I have an issue with a tab bar app. I am making a tab bar app with three bars on the bottom. On my my first bar it is a tableviewcontroller. When i ckick on the table view controller it takes me to a different view (which doesn't have the tab bar). When I clicked back to the home screen (which has the tab) the tab bar is gone.If you need a picture i will post it!
You may have set your UITableViewController segue to a modal style. If this is the case, you should change it to a push style.
In order for a push to work, your view controller needs to be in a UINavigationController. In your story board, select your root view controller and embed it into a Navigation Controller like this...
I am currently developing an app that has a TabBarController and each of the tabs contains a navigation controller. This way on each tab I can show details of the rows selected on a view by pushing the viewcontroller to the navigation controller. Each of the views also have an UINavigationItem above them. In this navigation item I placed a button.
But now I would like to change the viewcontroller for a certain tab, when clicking the button in the UINavigationItem, BUT the view(controller) I want to change to has to act like the root view controller of that tab.
So I do not want to push another view on the navigation controller, but just switch to that view (in the same tab) and have that act as the root view controller.
I cannot find a good way to do this, with actually having the views work correctly. They either do not dealloc when I switch views (which would be nice, because I want to keep memory usage to a minimum).
One way of solving this, might be that I add more tabs to my TabBar Controller and just switch to the right tabs when I click the button, but that would be a last resort.
Not really sure if I described this correctly, but I was wondering what the best way is to do this. My preference is having 3 viewcontrollers and switch between them.
Hopefully I understand your question correctly: you want to basically 'reset' your navigation controller to have a new root.
You can do this by telling your navigation controller that you want to display a new set of view controllers:
[navigationController setViewControllers:[NSArray arrayWithObject:newViewController]
animated:NO];
This will get rid of all view controllers currently on that navigation controller's stack, and reset the root view to newViewController.