Re: Making a bound view re-read its value
Re: Making a bound view re-read its value
- Subject: Re: Making a bound view re-read its value
- From: Markus Spoettl <email@hidden>
- Date: Thu, 14 Aug 2008 20:10:46 -0700
On Aug 14, 2008, at 5:07 PM, Ron Lue-Sang wrote:
Here's how I look at your situation.
Your view is bound to some property. It's job is to listen for KVO
notifications and redraw when it gets the KVO notification. That's
it. One input. When there's a change on that one input, then redraw.
What you have is 2 inputs and only one notification.
ValueTransformers are meant to be less stateful than you're
intending them to be.
You might be tempted to try adding a notification for your celsius/
fahrenheit choice and call [self setNeedsDisplay]; But that's not
what I'd do.
I'd have whatever-controller-my-view-is-bound-to have a property
that represents the temperature based on the current settings. It
would receive the userDefault notification and update its temp.
property.
We've never explicitly defined a "do this to make the view refresh
its bound values". The main reason is that that's a messy way to
mentally model the way bindings work.
Sorry if that doesn't answer the question you asked, but hopefully
this is information you can use to get work done.
Thanks for the response, though it's unfortunate for me I guess.
The problem is that I actually have a lot arrays of lots of objects
each with a number of different properties that can be displayed in
more than one way (all dependent on one preference settings). Putting
these through proxies/proxy arrays so that I can use bindings and KVO
to make process automatic sounds like a terribly painful way to go -
plus it defeats the purpose of bindings a little (glue code wise).
I have suspected that my use of ValueTransformers is not quite what
they were intended for but they actually do this job very well.
Anyway, thanks for the advice.
Regards
Markus
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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