views:

600

answers:

1

In reference to my previous question, I would like to know how to implement a large grid of cells in an iPhone application.

I'm working on an interface which would be similar to an Excel spreadsheet, with many rows and columns. Do I have to handle each cell separately? How can I handle user interaction in each cell?

Is there a standard way to create this type of control?

+1  A: 

There is no real standard mechanism.

If all of the cells in a given row will always fit in the width of the screen, one way to do it would be to create a UITableViewCell with several UILabels and vertical separators between them. If all of these rows had "columns" of the same width, you would get the appearance of a grid.

If that isn't possible, it might be helpful to think about what the table view control truly is. A table view is just a scroll view that automatically adds, removes, and recycles its subviews so that only the ones that are visible at a given time are in memory. There is no reason you could not write a GridView control that did the same thing, but in two dimensions. It wouldn't be as easy as using the built-in table view, of course, but if the table view can't do what you need, well, that's why Apple isn't writing all the apps.

Brent Royal-Gordon