PDA

View Full Version : Using Object Controller for Binding




Sergio10
Mar 29, 2009, 07:23 PM
Hi,
I use Object Controller in xcode 3.1 for the control bindings.

I want that edit field control shows my slider position when drag it.

How do I know what exactly value I need to bind in Binding Inspector of the Interface Builder("stringValue", "value" or "floatValue") ?
http://pic.ipicture.ru/uploads/090330/hCtOIctPo2.png

Thanks,
Sergio



kainjow
Mar 30, 2009, 08:08 AM
I'd bind both your text field and slider to either file's owner or an object controller to the same value. Bindings don't work from a UI object to another, they work from a UI object to a controller.

Sergio10
Mar 30, 2009, 12:36 PM
I mean how to know that max slider position parameter is "maxValue" not "MAX_VALUE" or something else? Where can I see controls name convention parameter when I bind it via Interface Builder?

kainjow
Mar 30, 2009, 01:06 PM
While bindings can do this, you can't bind a control directly to another with this approach. I would suggest reading through the intro (http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/CocoaBindings.html) to bindings.

What you can do is control-click your slider and drag to the text field, and then select "takeIntegerValueFrom:" (or one of the other similar methods). You can then select on the slider attributes inspector "Continuous" for it to update instantly.