• 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 a binding?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: binding a binding?


  • Subject: Re: binding a binding?
  • From: Seth Willits <email@hidden>
  • Date: Mon, 20 Feb 2012 11:58:27 -0800

On Feb 19, 2012, at 3:11 PM, William Squires wrote:

>  Now, I can bind the label's value to File's Owner's self.stringInterval without Xcode/IB complaining.
>  I think you can all see where this is going... yep, the label doesn't update because it's static; there's nothing to tell the label to ask (through the binding) for the self.stringInterval's current value.
>
> 1) Is it better to use KVO to observe self.interval somehow from the label, so it receives the updated info
> 2) Bite the bullet and simply update the label's .text property in code when the slider's value changes?
> -or-
> 3) is there a way I can directly bind intervalLabel's value to self.interval using an NSValueTransformer?

All three are unnecessary. You have other options.


1) You can binding the label text field's Value binding to a CGFloat. It'll work fine. Use a number formatter on the field to get the right display formatting.


2) Let's say you're binding to stringInterval. Implement keyPathsForValuesAffectingStringInterval. Whenever interval changes, KVO notifications for stringInterval are also sent so the two are always in sync.

+ (NSSet *)keyPathsForValuesAffectingStringInterval
{
	return [NSSet setWithObject:@"interval"];
}



--
Seth Willits



_______________________________________________

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


References: 
 >binding a binding? (From: William Squires <email@hidden>)

  • Prev by Date: Re: My runloop-based async code breaks with GCD
  • Next by Date: Re: How EXC_BAD_ACCESS in objc_msgSend if receiver, parms OK?
  • Previous by thread: binding a binding?
  • Next by thread: Re: binding a binding?
  • Index(es):
    • Date
    • Thread