I need to keep 90x90 array data for iphone app. how can i keep this data? making an multi-dimensional array is a solution for this big table. or is there an other solution.
-
What kind of interactions with the data will you need? – PEZ Jun 08 '12 at 13:45
-
Check the accepted answer to this question: http://stackoverflow.com/questions/4982617/objective-c-create-a-multi-dimensional-array-with-the-dimensions-specified-at – PEZ Jun 08 '12 at 13:53
-
ok i got it.i will try. thanks a lot: Pez & Joe – AykutE Jun 08 '12 at 13:56
3 Answers
If the matrix is always 90x90, then you should just use C arrays.
Unless you have a special need for passing the matrix around, searching using predicates, or need some other feature of NSArray, then keep it simple.

- 42,202
- 8
- 92
- 117
You can:
Use a single Obj-C array containing 8100 elements and map your rows and columns onto the single index yourself:
index = (row * 90) + column;
Create an Obj-C array containing 90 Obj-C arrays of 90 elements each.
Hash the row and column together into a single key that you can use with a dictionary. This could be a good solution especially if the array is sparse.
Use a single- or multi-dimensional C array, especially if the elements of the array are plain old C types, like
int
. If you're storing objects, it's better to go with an Obj-C container.

- 124,013
- 19
- 183
- 272
Iphone's have a built in database SQL-Lite. I'd look into that to see if it meets you needs

- 8,554
- 3
- 27
- 38
-
i will try array first. if it slows the app than i look sqlite. thanks Sunrize – AykutE Jun 08 '12 at 13:57
-
@AykutE sqlite will slow your code down, not the other way around. Only consider SQLite if you find the array insufficient and you require persistent storage. – Joe Jun 08 '12 at 14:03