Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

batfink-dan

macrumors newbie
Original poster
May 16, 2009
3
0
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.
 
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.
 
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.
 
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.
 
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.

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.