• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binding and Observers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: Finding process path from Cocoa?
  • Next by Date: Re: NSURLConnection Problem Inside QuickLook Generator
  • Previous by thread: Re: Binding and Observers
  • Next by thread: Unable to write in InfoPlist.strings file from cpp
  • Index(es):
    • Date
    • Thread