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?

Community
  • 1
  • 1
  • Looks like most of your question is missing... – Chris Kimpton Mar 19 '09 at 07:09
  • Stackoverflow works without your own context: for each question, you have to shortly describe your situation. In this case, I assume this is found in your previous question: http://stackoverflow.com/questions/661148/iphone-development – mouviciel Mar 19 '09 at 07:09
  • @jaynaiphone: Welcome to Stackoverflow. I cleaned up your question, but for future questions, you should really add a proper title, and select some meaningful tags. Have a look at the FAQ for more info: http://stackoverflow.com/faq – e.James Mar 19 '09 at 07:14
  • possible duplicate of [MS Excel type spreadsheet creation using objective-c for iOS app](http://stackoverflow.com/questions/14892174/ms-excel-type-spreadsheet-creation-using-objective-c-for-ios-app) – JP Illanes Oct 28 '14 at 01:19

3 Answers3

1

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.

Becca Royal-Gordon
  • 17,541
  • 7
  • 56
  • 91
0

Sounds like the exact thing that UICollectionView was made for!

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UICollectionView_class/Reference/Reference.html

Lance
  • 8,872
  • 2
  • 36
  • 47
0

Look at my answer to this question: MS Excel type spreadsheet creation using objective-c for iOS app.

Basically there's no standard way to do this. You will need to made everything by hand and there's 3 ways to go:

  1. Use a UIWebView and layout everything using html/js.
  2. Modify a UICollectionView.
  3. Make everything by hand using Core Data.
JP Illanes
  • 3,665
  • 39
  • 56