Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

iPhone: Navigation, Table View & Menus

Options
  • 24-10-2010 1:36pm
    #1
    Registered Users Posts: 8,004 ✭✭✭


    Hi Folks,

    I have two applications that I would like to build into one. The first is a simple table view that drills down to a detail view when a cell is clicked. It works fine. It has a TableView and a Navigation Controller, so I can go back and forth between cells. The problem is I don't want an App that shows a table straight away! I need a main menu, so cue my next App.

    My other App has three views that can be loaded by clicking a TabBar. One is called "Home". When you click "Home" it presents a view and some buttons. One of these buttons is called "Show Table"

    Here is where it gets tricky:

    When I click "Show Table", how do I load the TableView and the Navigation controller into the view, so I can use the table and the detail view? From some basic poking around today I can get the table to load, but I cannot get the Navigation to show, so when I click a Cell, nothing happens.

    My code for the first Table view app is here:

    http://www.iphonesdkarticles.com/2009/01/uitableview-loading-detail-view.html

    Any help would be great!

    ironclaw.


Comments

  • Subscribers Posts: 1,911 ✭✭✭Draco


    How are you loading the TableView?
    If you use the following:
    [self.navigationController pushViewController:vc animated:YES]
    
    it will push the table view onto the navigation stack. You don't need to load a separate navigation controller.


  • Registered Users Posts: 8,004 ✭✭✭ironclaw


    So basically my button press event should push the table view into place? I presume by "vc" that is the view controller of my table view?

    Also to note the navigation bar is not present when the main menu view is loaded, I need it to load if a button is pressed e.g. "Show All Staff" which will load a navigable table. Does that change the implementation?

    Also, where should the navigation controller exist? In the MainWindow.xib? And then how do I relate this to the table view?

    I have to be honest and say I'm fairly confused about views. The books I've read always deal with iPhone's prebuilt View Based etc, none I've found go into this sort of detail :(


  • Subscribers Posts: 1,911 ✭✭✭Draco


    ironclaw wrote: »
    So basically my button press event should push the table view into place? I presume by "vc" that is the view controller of my table view?
    Yes and vc is an instance of your TableViewController.
    ironclaw wrote: »
    Also to note the navigation bar is not present when the main menu view is loaded, I need it to load if a button is pressed e.g. "Show All Staff" which will load a navigable table. Does that change the implementation?

    Also, where should the navigation controller exist? In the MainWindow.xib? And then how do I relate this to the table view?
    I'd have the nav bar defined in your root controller (which would be loading MainWindow.xib) then you don't have to worry about it again. \when ther app loads, hide the nav bar in the first view and enable it in the other controllers.
    ironclaw wrote: »
    I have to be honest and say I'm fairly confused about views. The books I've read always deal with iPhone's prebuilt View Based etc, none I've found go into this sort of detail :(
    I found the Apress books a good starting point. there'd be some out of date stuff in there, but it'd get you started on the right track.


  • Registered Users Posts: 7,182 ✭✭✭Genghiz Cohen


    Draco wrote: »
    I found the Apress books a good starting point. there'd be some out of date stuff in there, but it'd get you started on the right track.

    Yes!
    A thousand times yes!

    Great book.
    Also, if there ever seems to be a leap in logic or you can't quite understand how something was done, I've come across a few errors in my version that were explained in their forums.


  • Registered Users Posts: 8,004 ✭✭✭ironclaw


    Cheers folks. I can get a menu to load and from a button press, get the table view to load. I just need to integrate the ToolBar now... :)


  • Advertisement
Advertisement