Reputation: 97
My bug is as follows:
In ViewList I have the code below which does push the ViewManager;
- (Void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{
PropertyManagerViewController propertyManagerViewController * = [[PropertyManagerViewController alloc] initWithNibName: @ "PropertyManagerViewController" bundle: nil];
[self.navigationController pushViewController: propertyManagerViewController animated: YES];
}
In ViewManager create the UITabBarController :
- (void) createTabBarController
{
[ ShowTabBarController showTabBar : self.navigationController.tabBarController ] ;
NSMutableArray * viewControllers = [ [ NSMutableArray alloc ] init ] ;
UITabBarController * TabBarController = [ [ UITabBarController alloc ] init ] ;
ViewController * viewController = [ [ ViewController alloc ] initWithNibName : @ " ViewController " bundle: nil ] ;
UINavigationController * navigationController = [ [ UINavigationController alloc ] initWithRootViewController : ViewController ] ;
[ ViewControllers addObject : navigationController ] ;
ViewController2 viewController2 * = [ [ VisitDetailsViewController alloc ] initWithNibName : @ " ViewController2 " bundle: nil ] ;
UINavigationController * navigationController2 = [ [ UINavigationController alloc ] initWithRootViewController : ViewController2 ] ;
[ ViewControllers addObject : navigationController2 ] ;
tabBarController.viewControllers = viewControllers ;
self.navigationController.tabBarController.viewControllers = tabBarController.viewControllers ;
} .
In ViewController and View ViewController2 have this method to push the ViewList.
-(void)pushTableList
{
[ShowTabBarController hideTabBar:self.tabBarController];
PropertyListViewController *propertyList = [[PropertyListViewController alloc] initWithNibName:@"PropertyListViewController" bundle:nil];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController:propertyList animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
}
My problem now is:
Update :
I want to click the table cell and then push the ViewController. The problem is: I click on the cell, the view is showing ViewContoller 2 (which is the last view I had) when I push to ViewList.
New Update
1 - Push and create UITabBArController
-(Void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{
PropertyManagerViewController propertyManagerViewController * = [[PropertyManagerViewController alloc] initWithNibName: @ "PropertyManagerViewController" bundle: nil];
[self.navigationController pushViewController: propertyManagerViewController animated: YES];
}
- (void) createTabBarController
{
[ ShowTabBarController showTabBar : self.navigationController.tabBarController ] ;
NSMutableArray * viewControllers = [ [ NSMutableArray alloc ] init ] ;
UITabBarController * TabBarController = [ [ UITabBarController alloc ] init ] ;
ViewController * viewController = [ [ ViewController alloc ] initWithNibName : @ " ViewController " bundle: nil ] ;
UINavigationController * navigationController = [ [ UINavigationController alloc ] initWithRootViewController : ViewController ] ;
[ ViewControllers addObject : navigationController ] ;
ViewController2 viewController2 * = [ [ VisitDetailsViewController alloc ] initWithNibName : @ " ViewController2 " bundle: nil ] ;
UINavigationController * navigationController2 = [ [ UINavigationController alloc ] initWithRootViewController : ViewController2 ] ;
[ ViewControllers addObject : navigationController2 ] ;
ViewController3 viewController3 * = [ [ VisitDetailsViewController alloc ] initWithNibName : @ " ViewController3 " bundle: nil ] ;
UINavigationController * navigationController3 = [ [ UINavigationController alloc ] initWithRootViewController : ViewController2 ] ;
[ ViewControllers addObject : navigationController3 ] ;
tabBarController.viewControllers = viewControllers ;
self.navigationController.tabBarController.viewControllers = tabBarController.viewControllers ;
}
2 - Select TabBarITem Visit Details and click UIBarButtonItem Property List
3 - Click on the Cell of the da table.
4 - Here's the my problem. If you look back to tabbaritem Visit. I want you to show me PropertyItem
Upvotes: 0
Views: 475
Reputation: 44730
you might want to check out this document: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/AboutViewControllers/AboutViewControllers.html
One very important piece of information: a UITabBarController always has to be the top-level controller! You are not allowed to put a UITabBarController inside of a UINavigationController. You are allowed, however, to put a UINavigationController inside of a UITabBarController. The Apple docs about UINavigationController's pushViewController:animated: method say:
The view controller that is pushed onto the stack. This object cannot be an instance of tab bar controller and it must not already be on the navigation stack.
I hope this points you into the right direction.
Upvotes: 1