0

i am testing all day on this but i can not get it to work.

I have my main App Delegate class with my MainWindow.xib.
In this main class i create my navigation controller and MainWindow points to my MainViewController.xib. In this MainViewController i have a simple tableview, where i push some views on the navigation stack.

Till here it's working great. But i want the user to switch between two styles of presenting him data. One is the tableview, and the other option is something like a map. Doesn't matter. Just 2 different Views. So i thought of using a button on my nav bar to flip between these two views.
Don't get this subview flip to work.

I tried it with that source but didn't get it to work.

Some hints would be great!

Community
  • 1
  • 1
madmax
  • 1,803
  • 3
  • 25
  • 50

1 Answers1

3

Suppose you have all the navBar, buttons ready. You can use modal view for the solution:

-(void)changeView{
    //create some view
    [youNewView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    [self presentModalViewController:youNewView animated:YES];
}

You can use the above method to flip to a new view.

-(void) dismissView{
    [self dismissModalViewControllerAnimated:YES];
}

and use the second method in the new view to flip back.

I like this method a lot because you don't need to add any controller manually at all.

Xiao
  • 873
  • 6
  • 10
  • Thank you! It works. But now i don't have my nav controller in the second modal view. Or do i have to create 2 nav controllers for every modal view? – madmax Mar 25 '11 at 09:33
  • If you just need to show the second view and no more, you don't need it. But if you have more views to show from the second one, you may want to have another controller. A controller isn't required. – Xiao Mar 25 '11 at 10:44
  • Yes, i need from both views more views. In fact the views i link to are the same, they are only different listed in the modal views. And at the moment i cant get the second nav controller to show. – madmax Mar 25 '11 at 12:12