I want to implement thing like that but i get error in add because of id !!!
NSMutableArray *rgbarray = [[NSMutableArray alloc] init];
NSInteger rgb[3];
const CGFloat *components = CGColorGetComponents(cgcolor);
CGFloat cgred = components[0];
CGFloat cggreen = components[1];
CGFloat cgblue = components[2];
rgb[0] = cgred;
rgb[1] = cggreen;
rgb[2] = cgblue;
[rgbarray addObject:rgb];
i want to add rgb instead of id ?
You can only add pointers to instances of objects into
NSMutableArrayYou can use a
NSDictionaryor create your own subclass ofNSObjectto wrap the 3 values.To retrieve the values
I would actually use the subclass approach. Since you were trying to code with a C array for your values, the
NSDictionaryapproach will get you past the error.