0

I have the tab controller with 3 tabs that have navigation controllers inside of them:

// account view
UINavigationController * firstNavController = [[UINavigationController alloc]initWithRootViewController: viewController1];
viewController2.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:2];

// book view
UINavigationController * secondNavController = [[UINavigationController alloc]initWithRootViewController: viewController2];
viewController3.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:3];

// invite view
UINavigationController * thirdNavController = [[UINavigationController alloc]initWithRootViewController: viewController3];


CATransition *transition = [CATransition animation];
transition.duration = 0.7f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;

[firstNavController.view.layer addAnimation: transition forKey:nil];
[secondNavController.view.layer addAnimation: transition forKey:nil];
[thirdNavController.view.layer addAnimation: transition forKey:nil];

_tabBarController.viewControllers = [[NSArray alloc] initWithObjects: firstNavController, secondNavController, thirdNavController,  nil];

I have a navigation bar with a right button that lets people go to the My account page. How can I do without using the navigation controller? For example, if people click tab bar button 1, they get a navigation controller (with the list of services they can choose from). If they click on the My Account button on the top right, it should open a new navigation controller with the tab bar on the bottom so that they cannot click back button on the My account page (because that is the root controller in this new navigation controller.

How can I do this?

Basically, I want to open a new view controller (controller 1 - my account) from another view controller (controller 2) without pushing that new view controller into the navigation controller of controller 2. controller 1 should have the tab bar at the bottom but no back button.

3
  • Do you want your account controller to be in a navigation controller but with no navigation bar, or do you not want it in a navigation controller at all? Commented Dec 2, 2012 at 4:31
  • I want it to be in its own navigation controller with the tab bar at the bottom. Commented Dec 2, 2012 at 5:01
  • But no navigation bar at the top, right? Commented Dec 2, 2012 at 5:02

2 Answers 2

1

From controller 2, you can use this to switch to the first controller (I assume you mean the controller at the first tab):

self.tabBarController.selectedIndex = 0;

I think you can hide the navigation bar in the viewDidAppear method of your first controller by using self.navigationBarHidden = YES

Sign up to request clarification or add additional context in comments.

Comments

0

Instead of pushing your LoginViewController, try to use presentModalViewController.

In your navigation rightBarButton action give

[self presentModalViewController:loginViewController animated:YES];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.