How do I declare an array of arrays in Objective-C?
-
If you're very new to programming, asking questions on Stack Overflow is not the place you need to be. You should find a good book or a series of online tutorials. Have a look at Good resources for learning ObjC. The Big Nerd Ranch books are excellent, and lots of people like the Stanford iOS course on iTunes U. Good luck!jscs– jscs2014-02-24 03:28:36 +00:00Commented Feb 24, 2014 at 3:28
Add a comment
|
3 Answers
Assume you have the objects obj1,obj2,...,obj9
Then this would create an array containing three members:
NSArray *array = @[obj1,obj2,obj3];
And this would create an array of arrays, each containing three members:
NSArray *array = @[ @[obj1,obj2,obj3], @[obj4,obj5,obj6], @[obj7,obj8,obj9] ];