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: Ron Lue-Sang <email@hidden>
- Date: Thu, 14 Aug 2008 17:07:02 -0700
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.
On Aug 14, 2008, at 4:03 PM, Markus Spoettl wrote:
On Aug 14, 2008, at 3:28 PM, Kyle Sluder wrote:
On Thu, Aug 14, 2008 at 6:21 PM, Markus Spoettl
<email@hidden> wrote:
So how can I manually make the view update? It seems so simple but
I can't
figure out how to do this.
I can think of a couple of ways:
1) When your preference changes, post a notification. The views
listen for that notificiation, and update themselves accordingly.
OK, but that's exactly what I tried to get down to: How do I make a
view update when its value is bound to something. If I feed the
value to the view manually, I can do just that again. But how do I
make the view update when its value is bound?
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
--------------------------
RONZILLA
_______________________________________________
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