tags:

views:

37

answers:

2

i want to go from any sub view to main view directly on a single button click but not pressing back again and again

A: 

You could use the following UINavigationController method when the back button is tapped:

- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
Run Loop
+1  A: 

I guess you are looking for this:

[self.navigationController popToRootViewControllerAnimated:YES];

That will pop all view controllers down to the root. If the main menu is not your root view controller then you can use this:

[self.navigationController popToViewController:mainMenuVC animated:YES];

In this case you need to have a "pointer" to the mainMenuVC available. You can do that by setting a property in the App Delegate.

Hope it helps!

gonso