PDA

View Full Version : I'm having trouble with a basic concept - Switching views




ethana
Dec 30, 2008, 06:14 PM
OK I hate to admit this, but I'm having trouble with a basic concept: Switching views. Someone PLEASE HELP!

I've started off with the basic project using the "View-based application" template that Xcode provides. I've called the project "testing". When it opens in Xcode, I have a testingViewController.xib and a MainWindow.xib.

I've created a button in Interface Builder on the View within testingViewController.xib. I've connected the button to a method called (IBAction)switchViews which I created. The method is currently empty.

I've also created a new View (called Second.xib) and ViewController (called SecondViewController .h and .m). In Interface Builder I attached the xib to the class.

Ok so now for my question. When I press the button on my testingViewController.xib, how do I make it show my Second.xib???

Thanks!

Ethan



neil.b
Dec 30, 2008, 08:36 PM
Look at, study and understand the Xcode template "Utility Application".

:)

liptonlover
Dec 31, 2008, 08:37 AM
I don't do it the way most do, but here's how I did it.

I start a project, just a basic iphone app with a window. I put 2 views in the window, one directly on top of the other. To switch views, just use an external custom class that's connected to the two views, the window, and the buttons for switching. When the user presses the button, the other view is brought to the top using the method in uiwindow or uiview, can't remember which.