Newbie advice

Discussion in 'iOS Programming' started by batfink-dan, May 16, 2009.

  1. batfink-dan macrumors newbie

    Joined:
    May 16, 2009
    #1
    Hi, I am currently playing around writing little apps via the various online tutorials and 'Learning iPhone Development'. My question is, how can I display a table of data with multiple columns and an undefined number of rows?

    If I knew the number of rows, I guess I could take the somewhat tedious route of using a load of labels or text fields.

    If I only wanted a single column of data I can see how I could use the Table View Controller.

    I can also see how I could use multiple table views next to each other, but if I did that then the rows wouldn't stay aligned when I scrolled down.

    There's probably a really simple answer to this, but would anyone mind enlightening me? :confused:

    Cheers.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    I'd like more elaboration on what you mean by "undefined number of rows" but you can do a varying amount of rows using a UITableView. Then you can either subclass a UITableViewCell or just populate the contentView of a cell with subviews to achieve the multiple columns. Hope that helps.
     
  3. batfink-dan thread starter macrumors newbie

    Joined:
    May 16, 2009
    #3
    Aye-aye - that sounds like a solution. I actually meant a user-defined number of rows, so 'undefined' as in 'I don't know, but the user would', but that would preclude the use of several text fields or labels adjacent to each other.

    Thanks for the pointer.
     
  4. johnnyjibbs macrumors 68030

    johnnyjibbs

    Joined:
    Sep 18, 2003
    Location:
    London, UK
    #4
    Table views are flexible so you can add more rows or take some away as necessary while your app is running.
     
  5. veo321 macrumors regular

    veo321

    Joined:
    May 12, 2009
  6. drivefast macrumors regular

    Joined:
    Mar 13, 2008
    #6
    as for going multiple columns across, unless your columns are relatively narrow, you may soon run out of real estate. the table view is only designed for a single column, and you can have sections for a better classification, but any more than 1 column you will need to come up with your own design. i would probably try multiple, narrow table views in a UIScrollView, or a single UIScrollView that can scroll both horizontally and vertically. hmm, and if i think better, it may be easier to go directly for the 2nd alternative. this is not an application that i would recommend to beginners though, as it takes a good deal of experience with the standard classes.
     
  7. batfink-dan thread starter macrumors newbie

    Joined:
    May 16, 2009
    #7
    Um, I needed to read that a couple of times to make sense of it, so I think it's currently beyond me! For info, I have a table view and have forced landscape orientation, as it simply wouldn't fit into a portrait view. Thanks for the help.
     

Share This Page