Re: Arghh bindings
Re: Arghh bindings
- Subject: Re: Arghh bindings
- From: Rick Mann <email@hidden>
- Date: Mon, 10 Sep 2012 18:48:32 -0700
On Sep 10, 2012, at 18:39 , Graham Cox <email@hidden> wrote:
>
> On 11/09/2012, at 11:29 AM, Rick Mann <email@hidden> wrote:
>
>> - (void)
>> insertConnection: (NSDictionary*) inConn
>> atIndex: (NSUInteger) inIndex
>>
>> and the removal counterpart. Didn't help. I recall the mere presence of those in the past fixed my issues, and I could still add and remove objects to the mutable array directly (via its property).
>
> Yeah... but if you have the accessors you should be using them if you expect KVO notifications to be sent reliably in every possible case.
>
>
>>
>> So I tried calling -insertConnection:atIndex: instead. Still didn't help.
>>
>> What am I overlooking?
>
>
> Shouldn't this be insertObject:inConnectionsAtIndex: etc?
The docs say you can implement either insertObject: or insert<Key>. I figured it was smart enough to handle the plural-vs-singular change, otherwise it's grammatically awkward.
However, implementing the -insertObject: variant, and calling that, now seems to result in the correct behavior. Looking at my old code, I was calling -mutableArrayValueForKey:, which is why that worked.
To this day I'm a little puzzled why a simple NSMutable property needs all the extra scaffolding. It really seems like you should get this behavior for free, and only need to implement those methods when the thing backing it isn't a standard collection.
Anyway, thanks for pushing me to try one more thing.
--
Rick
_______________________________________________
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