Re: Binding and Observers
Re: Binding and Observers
- Subject: Re: Binding and Observers
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Wed, 9 Dec 2009 17:11:07 +0700
On 9 Dec 2009, at 07:05, mmalc Crawford <email@hidden> wrote:
>
> On Dec 8, 2009, at 2:17 am, Gerriet M. Denkmann wrote:
>
>> - (void)windowWillClose:(NSNotification *)notification
>> {
>> id f = [ ikView observationInfo ];
>> NSString *oi = [ f description ];
>>
>> BOOL ok;
>> NSString *obs = @"Observer:";
>> NSString *kpa = @"Key path:";
>> unsigned long long uuu;
>> NSString *keyPath1;
>>
>> NSScanner *u = [ NSScanner scannerWithString: oi ];
>> [ u setCharactersToBeSkipped: [ NSCharacterSet whitespaceAndNewlineCharacterSet ] ];
>>
>> ok = [ u scanUpToString: obs intoString: NULL ];
>> ok = [ u scanString: obs intoString: NULL ];
>> ok = [ u scanHexLongLong: &uuu ];
>> ok = [ u scanUpToString: kpa intoString: NULL ];
>> ok = [ u scanString: kpa intoString: NULL ];
>> ok = [ u scanUpToString: @"," intoString: &keyPath1 ];
>> [ myIkView removeObserver: (id)uuu forKeyPath: keyPath1 ];
>> }
>>
>
>
> ???!!
> What's wrong with unbind:?
> <http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSKeyValueBindingCreation_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/unbind:>
Nothing is wrong with unbind. Wrong are only the narrow limits of my knowledge.
Acting upon your kind suggestion, I replaced the clumsy code above with:
- (void)windowWillClose:(NSNotification *)notification
{
[ rotationSlider unbind: @"value" ];
[ zoomSlider unbind: @"value" ];
}
and now everyting works perfectly - no more exceptions, no more EXC_BAD_ACCESS.
In one word: complete bliss (well: two words).
Thanks a lot!
Gerriet.
_______________________________________________
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