Mac Developer Library

Developer

IKImageView Class Reference

Options
Deployment Target:

On This Page

IKImageView

The IKImageView class provides an efficient way to display images in a view while at the same time supporting a number of image editing operations such as rotating, zooming, and cropping. It supports drag and drop for the NSFilenamesPboardType flavor so that the user can drag an image to the view. If possible, image rendering uses hardware acceleration to achieve optimal performance. The IKImageView class is implemented as a subclass of NSView. Similar to NSImageView, the IKImageView class is used to display a single image.

You can provide an images for the view in any of these formats:

Providing a file reference is the preferred way to set the the image for a view because in addition to the actual image data, IKImageView also handles the image metadata embedded in the file. The image view automatically fetches the metadata from a file reference, whereas for the other sources (except for a CGImageSourceRef source), it cannot. For images set from other sources, you need to set the metadata separately.

IKImageView supports multi-frame images (TIFF, GIF, and so forth) and animated images.

  • Specifies the delegate object of the receiver.

    Declaration

    @property(assign) id delegate

    Discussion

    An IKImageView object’s delegate is inserted in the responder chain after the image view itself and is informed of various actions by the image view through delegation messages.

  • Specifies the zoom factor for the image view.

    Declaration

    @property CGFloat zoomFactor

  • Specifies the rotation angle for the image view.

    Declaration

    @property CGFloat rotationAngle

  • Specifies the current tool mode for the image view.

    Declaration

    @property(copy) NSString *currentToolMode

    Discussion

    See Tool Modes for possible values.

  • Specifies the automatic resizing state for the image view.

    Declaration

    @property BOOL autoresizes

  • Specifies the horizontal scroll bar state for the image view.

    Declaration

    @property BOOL hasHorizontalScroller

  • Specifies the vertical scroll bar state for the image view.

    Declaration

    @property BOOL hasVerticalScroller

  • Specifies the automatic-hiding scroll bar state for the image view.

    Declaration

    @property BOOL autohidesScrollers

  • Specifies the drag-and-drop support state for the image view.

    Declaration

    @property BOOL supportsDragAndDrop

  • Specifies the editable state for the image view.

    Declaration

    @property BOOL editable

  • Specifies the image-opening state of the editing pane in the image view.

    Declaration

    @property BOOL doubleClickOpensImageEditPanel

  • Specifies a Core Image filter for image correction.

    Declaration

    @property(assign) CIFilter *imageCorrection

  • Specifies the background color for the image view.

    Declaration

    @property(assign) NSColor *backgroundColor

  • Returns the size of the image in the image view.

    Declaration

    - (NSSize)imageSize

    Return Value

    The size of the image.

    Discussion

    The image size changes whenever an image is rotates or cropped.

  • Returns the metadata for the image in the view.

    Declaration

    - (NSDictionary *)imageProperties

    Return Value

    A dictionary of metadata that specifies the image properties.

  • Sets the rotation angle at the provided origin.

    Declaration

    - (void)setRotationAngle:(CGFloat)rotationAngle centerPoint:(NSPoint)centerPoint

    Parameters

    rotationAngle

    The rotation angle to apply to the image.

    centerPoint

    The point that specifies the origin of the rotation angle.

    See Also

    rotationAngle

  • Sets the zoom factor at the provided origin.

    Declaration

    - (void)setImageZoomFactor:(CGFloat)zoomFactor centerPoint:(NSPoint)centerPoint

    Parameters

    zoomFactor

    The zoom factor to apply to the image.

    centerPoint

    The point that specifies the origin of the zoom factor.

    See Also

    zoomFactor

  • Zooms the image so that it fits in the image view.

    Declaration

    - (void)zoomImageToFit:(id)sender

    Parameters

    sender

    The object initiating the action.

  • Zooms the image so that it is displayed using its true size.

    Declaration

    - (void)zoomImageToActualSize:(id)sender

    Parameters

    sender

    The object initiating the action.

  • Zooms the image so that it fits in the specified rectangle.

    Declaration

    - (void)zoomImageToRect:(NSRect)rect

    Parameters

    rect

    The rectangle to fit the image in.

  • Zooms the image in.

    Declaration

    - (void)zoomIn:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

  • Zooms the image out.

    Declaration

    - (void)zoomOut:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

  • Crops the image using the current selection.

    Declaration

    - (void)crop:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

  • Flips an image along the horizontal axis.

    Declaration

    - (void)flipImageHorizontal:(id)sender

    Parameters

    sender

    The object initiating the action.

  • Flips an image along the vertical axis.

    Declaration

    - (void)flipImageVertical:(id)sender

    Parameters

    sender

    The object initiating the action.

  • Rotates the image left (counter-clockwise).

    Declaration

    - (void)rotateImageLeft:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

  • Rotates the image right (clockwise).

    Declaration

    - (void)rotateImageRight:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

  • Image Kit tools modes referenced by the currentToolMode property.

    Declaration

    NSString *const IKToolModeNone; NSString *const IKToolModeMove; NSString *const IKToolModeSelect; NSString *const IKToolModeSelectRect; NSString *const IKToolModeSelectEllipse; NSString *const IKToolModeSelectLasso; NSString *const IKToolModeCrop; NSString *const IKToolModeRotate; NSString *const IKToolModeAnnotate;

    Constants

    • IKToolModeNone

      No tool is set.

    • IKToolModeMove

      The move tool.

    • IKToolModeSelect

      The selection tool.

    • IKToolModeSelectRect

      Same as IKToolModeSelect.

    • IKToolModeSelectEllipse

      The selection ellipse.

    • IKToolModeSelectLasso

      The selection lasso.

    • IKToolModeCrop

      The crop tool.

    • IKToolModeRotate

      The rotation tool.

    • IKToolModeAnnotate

      The annotation tool.

  • A layer level.

    Declaration

    NSString *const IKOverlayTypeBackground; NSString *const IKOverlayTypeImage;

    Constants

    • IKOverlayTypeBackground

      A background.

    • IKOverlayTypeImage

      An image.