Multiple views on one view

Discussion in 'iOS Programming' started by youPhone, Sep 8, 2008.

  1. youPhone macrumors member

    Joined:
    Sep 8, 2008
    #1
    I have a tab bar controller set up and it has navigation controller pages set each tab loads a separate xib

    On the first tab, I want to load a screen (for lack of a better word) that has a view on the top half of the screen with some text, etc... and I also want to load a tableview on the bottom half of the screen (this is in addition to the nav bar on top and tab bar on bottom). I want the top view to stay on the screen while the tableview is permitting to scroll.

    Can someone give me a bump in the right direction?

    I have made the page with the tableview by itself using a tableViewController in its own xib, but I can't add the other top half view on there like that.

    I've tried making just a viewcontroller with a top view and bottom table view and that will load with a blank table, but I'm uncertain how to get the data in there.
     
  2. Niiro13 macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #2
    What's wrong with that? Loading the data should be exactly the same as if the tableView was the only view. As in exactly the same.
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    I don't really use the table view controllers but I think they might automatically set the datasource and delegate for the tableview to themselves. Using a standard view controller means you have to set these yourself (not hard).
     
  4. Niiro13 macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #4
    Yeah, I use table view controllers and they do set it to themselves (then again, I'm not advanced enough to use another file as a datasource :p)

    To OP, all you need to do is to set the datasource and/or delegate property to your data file.
     
  5. youPhone thread starter macrumors member

    Joined:
    Sep 8, 2008
    #5
    I was starting to write up another post trying to go through the steps and try to convey to you what I wasn't understanding, but fortunately, I found what I was not understanding. I didn't understand how I was supposed to set up the delegate.

    In the MainWindow.xib, I needed to set the delegate for my view controller there to my navigation controller

    I didn't have to touch the xib for that view controller either, it already had the delegate and dataSource pointing to the File's Owner

    Can't believe I missed that earlier.

    Thanks for all the help.
     

Share This Page