Re: putting structs in NSArray
Re: putting structs in NSArray
- Subject: Re: putting structs in NSArray
- From: "Philip D Riggs" <email@hidden>
- Date: Tue, 26 Aug 2003 11:22:44 -0600
Maybe I'm missing something, too. I understood that NSArray and
NSMutableArray could only take NSObjects. Why not make this an NSObject str
and skip the NSValue etc. stuff? Aaron Hillegass' book has an example of
adding, accessing, and deleting objects in arrays.
================================
i just can't suss this one. trying to put a struct into an array:
struct str {
int x;
char y;
BOOL z;
};
struct str s = {123456, '*', YES};
NSMutableArray *a = [[NSMutableArray alloc] initWithCapacity:2];
NSValue *v = [NSValue value:&s objCType:@encode(struct str)];
[a addObject: v];
----------------------------------------------------------------------------
----
Philip D. Riggs
GeoSpatial Analyst/ Laboratory Manager
Environmental Health Advanced Systems Laboratory
Colorado State University
Fort Collins, Colorado
970-491-6392
http://ehasl.cvmbs.colostate.edu/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.