Search code examples
objective-ccocoainterface-buildercocoa-bindingsikimageview

IKImageView zooming controlled by an NSSlider


What's the best practice for setting zoom factor of an image within IKImageView via NSSlider?

I was able to bind a slider either to zoom in OR zoom out action of an IKImageView. Obviously, what I'd rather see is a single slider controlling both those actions. Best, if image is refreshed after each change of the slider (continuously, even if a mouse button is not released yet).


Solution

  • This demo explains a lot: ImageKitDemo

    In particular, this snippet is what I was looking for:

    - (IBAction) zoomSliderDidChange:(id)sender
    {
        [addProductPhotoImageView setZoomFactor:[sender floatValue]];
    }