Re: NSSlider, NSStepper, and NSTextfield with Bindings: how to display initial value?
Re: NSSlider, NSStepper, and NSTextfield with Bindings: how to display initial value?
- Subject: Re: NSSlider, NSStepper, and NSTextfield with Bindings: how to display initial value?
- From: Quincey Morris <email@hidden>
- Date: Tue, 28 May 2013 13:33:54 -0700
On May 28, 2013, at 13:16 , Paul Johnson <email@hidden> wrote:
> I have a slider, a stepper, and a textField that are synchronized using
> bindings. I didn't write any code to do this, just used Xcode with its
> Interface Builder. When the program starts I don't see the slider set to
> the "Current" position I'd like and the textField doesn't show the
> "Current" value either. Is there something I can do within Xcode or do I
> need to add a line of code somewhere (in a -WindowControllerDidLoadNib:
> somewhere, maybe)?
This usually happens because something in the keypath of the binding isn't KVO compliant.
For example, if your controls are bound to "model.myValue" of File's Owner, and the "model" property doesn't get set until after the nib is loaded and it isn't set KVO compliantly, then your controls will see "myValue" as 0.
If you can't spot a property that's obviously non-compliant, it's going to be necessary to take the key path apart property by property and verify that each is doing the right thing.
Where is the initial value coming from? One of the values you set in the slider, stepper or text field in IB, or something else?
_______________________________________________
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