My intention is to create an App which has the Main View with UIButton to click. Once clicking one of the button will enter TabBarController View.
For example, when you click sample1 button will automatically select 2nd tab in TabBarController View. And when you click sample2 button will go to 3rd tab, more button will go to more tab which will display table view.
My problem is when I click the UITableViewCell in MoreViewController to get into detail view. But, when I want to go back to the TabBarController by clicking the upper-left button. The tab will change to the one I click in the Main View.
It seems the selectedIndex of the TabBarController didn't change, even though I set the value in the delegate method
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
or other places like viewWillAppear
viewWillDisappear
in the MoreViewController
, still, the value of the selectedIndex
stays the same.
The sample code is here -> http://uploadingit.com/file/qxfbw4cuzjdkk56v/9s.zip
Does anybody knows how to solve this problem?