Possible Duplicate:
What’s the best way to put a c-struct in an NSArray?
I need to create an array of structures, such as:
typedef struct
{
int fill;
BOOL busy;
} MapCellST;
How can I add instances of this structure in NSMutableArray and how I can extract copies of the structure and work with its properties later?
Wrap the struct in an NSValue
:
MapCellSt x;
NSValue* value = [NSValue value:&x withObjCType:@encode(MapCellSt)];
To extract it later:
[value getValue:&x];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With