I'm having trouble with a basic concept - Switching views

Discussion in 'iOS Programming' started by ethana, Dec 30, 2008.

  1. macrumors 6502a

    Joined:
    Jul 17, 2008
    Location:
    Seattle, WA
    #1
    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
     
  2. macrumors member

    neil.b

    Joined:
    Nov 20, 2008
    #2
    Look at, study and understand the Xcode template "Utility Application".

    :)
     
  3. macrumors 6502a

    Joined:
    Mar 13, 2008
    #3
    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.
     

Share This Page