• 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: Making a bound view re-read its value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making a bound view re-read its value


  • Subject: Re: Making a bound view re-read its value
  • From: Negm-Awad Amin <email@hidden>
  • Date: Fri, 15 Aug 2008 15:40:46 +0200

Hi,

Am Fr,15.08.2008 um 00:21 schrieb Markus Spoettl:

Hi List,

how can I make a view value which is bound to a property manually re-read (or update) the value it displays?

The simplified setup is this: I have an object, that stores its values (say a temperature) in Celcius. I also have an application preference that lets the user switch between temperatures in Celcius and Fahrenheit for viewing and editing. The view's value binding uses a value transformer that converts the value based on the current application setting.

When the user changes the preference, the view should update its value so it uses the right units. There is no change to the underlying data, so there's no change notification that would force the binding to refresh the view.

So how can I manually make the view update? It seems so simple but I can't figure out how to do this.
Do you know that view and the binding to be updated?

Try this, it simply simulates a model change

NSView* view = … // I assume, that you know that
NSDictionary* binding = [view infoForBinding:/*Probably @"value" … */]; // I assume, that you know that


id object= [binding objectForKey:NSObservedObjectKey];
NSString* keyPath= [binding objectForKey:NSObservedKeyPathKey];
[object willChangeValueForKeyPath:keyPath];
[object didChangeValueForKeyPath:keyPath];

But probably I misunderstood you.

Cheers,
Amin



Regards
Markus
--
__________________________________________
Markus Spoettl

_______________________________________________

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

Amin Negm-Awad email@hidden




_______________________________________________

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


  • Follow-Ups:
    • Re: Making a bound view re-read its value
      • From: Markus Spoettl <email@hidden>
References: 
 >Making a bound view re-read its value (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: CoreData, Object/Array Controllers and KVO
  • Next by Date: Re: Is this a bug, or am I hacking?
  • Previous by thread: Re: Making a bound view re-read its value
  • Next by thread: Re: Making a bound view re-read its value
  • Index(es):
    • Date
    • Thread