Question

It turns out that in order to do this one has to bind the NSSlider's Value to IKImageBrowserView's zoomValue.

My question is why it only works in this way? It seems more natural (to me) to bind IKImageBrowserView's zoomValue to NSSlider.intValue

Thanks!

Was it helpful?

Solution

The documentation for IKImageBrowserView states:

setZoomValue:
Sets the zoom value.

- (void) setZoomValue:(float)aValue;

Parameters
aValue
The zoom value. This value should be greater or equal to zero and less or equal than one. A zoom value of zero corresponds to the minimum size (40x40 pixels). A zoom value of one means images fits the browser bounds. Other values are interpolated.

If all you pass in is the integer value, you'll only ever get '0' and '1', which correspond to the minimum size, and 'fit the browser bounds, respectively. You also need to make sure to configure the slider to have a minimum value of 0 and a maximum value of 1 to make it work with IKImageBrowserView.

OTHER TIPS

Because its not like a bind. its not like IKImageBrowserView's zoomValue became the slider's value. It means that the slider sends a message to the IKImageBrowserView to set the zoomValue to the slider's value.

One alternate method for doing this is to bind both the image browser's zoomValue and the slider's value to the same key in another object. For example, if you wanted the zoom value to be remembered between relaunches of the app, you could bind both views to a particular key in the shared user defaults controller. Whenever either view changed, it would change the value in NSUserDefaults, then propagate through to the other view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top