views:

356

answers:

2

Hello,

After some research i found a piece of code which shows how to expand NSMutableArray functionality to use 2d arrays easily.

http://www.seattlexcoders.org/shared/Mutable%202D%20Array/

How would my declaration statement of this special NSMutableArray look like?

With the following

#import "ZNMutable2DArray.h"
@interface MainView : UIView {
    ZNMutable2DArray *tiles;
}

@property(nonatomic,retain) ZNMutable2DArray *tiles;

It gives me the error "syntax error before ZNMutable2DArray.."

Thank you, Chris

+4  A: 

ZNMutable2DArray is just a category on NSMutableArray, so you'd declare it as NSMutableArray *. There's nothing special about it — the methods are available to all NSMutableArrays. What it does is it creates an NSMutableArray filled with NSMutableArrays, and those are your "rows."

Chuck
+2  A: 

It's a category, not a subclass. A subclass you would declare as you had, but by compiling with this category, you have altered NSMutableArray itself. So declare it as:

NSMutableArray *tiles;
Kevin Conner