0

I'm having trouble in customising a tab bar controller. Please understand that I'm not allowed to post image since I joined just before. My app has a tabbar controller as a root view controller. Only the first tab is connected to a navigation view with a three-level hierarchy (1st Table view - 2nd Table view - Detail view).

Like the 'run keeper' app's UI, I want a 'shortcut' button at the center of my tabbar that show the (instantiated) detail view of the first tab. In other word, please imagine an iPhone Music app, with adding a 'Now Playing' button in tabbar.

For UI of the tab, I added a button as a subview of root view controller upon the center of tab bar. It worked, but I failed to implement other things; methods for the 'shortcut behaviour.

After touching the center button, the steps I suppose to happen are like these:

(i) to show the first tab
(ii) move to the 1st table view
(iii) select a cell from the 1st table view (depending on a number that is saved before)
(iv) select a cell from the 2nd table view (also depending on a number)


Sadly, the only step I successfully implemented is step (i), by tabbar controller's method

[self setSelectedIndex:0];

Since the touch from tabbar item [0] and the center button should be distinguished (by the navigation view controller), I add a boolean variable in appDelegate.m. So The navigation view know whether it's shown from tabbar item [0], or the center button.
Still, I couldn't find a way to do the three steps (ii),(iii), and (iv), in the navigation controller. Well, for (iii) and (iv), actually they are doing the same thing, and I partly figured out by post like this, though I used
[self performSegueWithIdentifier:@"showPlaces" sender:self]; instead of [self.tableViewForSchools.delegate tableView:self.tableViewForSchools didSelectRowAtIndexPath:indexPathSchool]; Well, since the step (ii) doesn't work well, I'm not sure I'm doing right in the following steps.


In short, I wonder if I could...
Q. force a navigation view controller to show the top master view.
Q. Or, there's other ways to do the same thing, to show a detail view by touching a button in tabbar embedding a navigation controller.

Community
  • 1
  • 1
Keunwoo Choi
  • 865
  • 7
  • 8
  • As for your first question, `[navigationController popToViewController:navigationcontroller.viewControllers.firstObject animated:YES];` would work. – duci9y Jul 27 '14 at 08:09
  • @duci9y, Thank you! I found out I could use `[self popToRootViewControllerAnimated:NO];`. I think my words were a bit confusing. I meant the bottom view controller of navigation view stack (==root view controller) by saying 'top master view'. But it helped greatly! – Keunwoo Choi Jul 27 '14 at 08:46
  • Oh yes, sorry about that. – duci9y Jul 27 '14 at 08:47
  • Oh no, I thank you very much. Sorry for asking a method that is already in the class reference :( – Keunwoo Choi Jul 27 '14 at 08:49

0 Answers0