-1

I am trying to get this method working correctly, but for some reason this function makes a previous controller (start up controller) appear instead of displaying the home controller.When I exit the start up controller my home controller shows up and works fine. The code below should be fine. Is there a way to prevent root controller popping up.Perhaps making disappear for good? Willing to post the root controller code if needed.

    UIViewController *startupController;

    startupController = [[homeViewController alloc] initWithNibName:nil bundle:nil];

    [self.navigationController pushViewController:startupController animated:NO];
    [self dismissModalViewControllerAnimated:NO];

Update: The code above me is located in a tab bar method where I created a tab bar, the reason behind it is I am trying to make it where if you push a certain tab bar button it will display this controller. Controllers are related by navigation controller. And here is also another tip, if I use this method [self presentViewController:homeNavigationController animated:NO completion:nil]; it appears normally without showing the root controller, but tab bars disappear.

  • You need to give more details about the structure of your app. What controllers do you have? How do they relate to each other? Where is the code you're showing above? – rdelmar Mar 21 '13 at 19:53
  • Ok,I updated to help you out more. – Felix Jones Mar 21 '13 at 20:02
  • It's still hard to tell what you're trying to do. What do you mean by "located in a tab bar method where I created a tab bar" -- this makes no sense. Are you talking about a tab bar or a tab bar controller? The way a tab bar controller is set up, it automatically goes to a controller when you click on a tab, you don't use any code to do that. – rdelmar Mar 21 '13 at 21:05

1 Answers1

1

You are using a navigation controller, so replace [self dismissModalViewControllerAnimated:NO]; with the following.

[self.navigationController popViewControllerAnimated:NO];

Jack Humphries
  • 13,056
  • 14
  • 84
  • 125