Re: structs in Mutable containers
Re: structs in Mutable containers
- Subject: Re: structs in Mutable containers
- From: "Christian Giordano" <email@hidden>
- Date: Tue, 16 Sep 2008 11:10:59 +0100
I didn't think about NSValue, thanks.
Do you mean valueWithPointer?
Cheers, chr
On Tue, Sep 16, 2008 at 11:00 AM, Phil <email@hidden> wrote:
> On Tue, Sep 16, 2008 at 9:18 PM, Christian Giordano
> <email@hidden> wrote:
>> Hi guys, I'm finding myself trying to add to mutable containers like
>> NSMutableDictionary or NSMutableArray instead of NSObjects subclasses,
>> just structs. For instance in a NSMutableDictionary the key was an
>> integer defined with #define. In this case I sort it with:
>>
>> ... forKey:[[NSNumber alloc] initWithInt:BAND_RED]];
>>
>> Not a really elegant solution but I can understand that those
>> containers require pointers.
>>
>
> You should really be using NSValue's for this. Take a read of:
> <http://developer.apple.com/documentation/Cocoa/Conceptual/NumbersandValues/Articles/Values.html>
>
>> Now I need to create a NSMutableArray of CGPoint, how can I make it
>> became a pointer?
>>
>> ... addObject:CGPointMake(x,y)];
>>
>
> See NSValue's +valueWithPoint:
>
> Phil
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden