0

When my app launches, it presents a navigation view with a tableview and a tabbar on the bottom.

Something like this:

TabBar --> UINav1, UINav2, UINav3, UINav4

Each UINav contains a ViewController that is eventually displayed.

What I want to be able to do is to change the UITabBar if the user moves from the ListView (Main screen) to the detail view.

I don't have to swap out the whole tabbar atleast change/remove the buttons.

However, if I use the above model (setting TabBarController as the root controller) then it seems it's pretty much stuck and immutable in the course of the navigation. The best I can do is just hide it in certain views.

Been banging my head for like a day trying to figure this out.

Thanks!

James
  • 1,689
  • 3
  • 17
  • 21

3 Answers3

0

You could use

- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated

in your UITabBarController to set the tabBar whatever viewController you wish

EDIT: You might wan't to look at this question wish seems to be quite similar iPhone, how I hide a tab bar button?

Community
  • 1
  • 1
ebany
  • 296
  • 1
  • 7
  • ebany, I'm working to get an answer for the hiding tab bar button as a workaround to the question you were helping me with yesterday. But I haven't been able to get either working :( – Jules Nov 17 '10 at 15:55
  • The problem with setViewControllers is that you're changing state of one global controller so that even if you go back (via nav) it's changed. – James Nov 18 '10 at 03:42
0

It is not very common but you can present a new tab bar controller along with its associated view(s) modally.

Assuming your listView is a UITableViewController, you can push the new tab bar controller in your didSelectRowAtIndexpath method.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// ...
[self.tabBarController presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated]

PS: I would be very careful with how you structure your UI in this case as it can get quite confusing for the user).

I hope it helps. Rog

Rog
  • 18,602
  • 6
  • 76
  • 97
0

Upon further research, decided that this was not feasible to do.

James
  • 1,689
  • 3
  • 17
  • 21