Mac OS X Reference Library Apple Developer
Search

IKImageView Class Reference

Inherits from
Conforms to
Framework
System/Library/Frameworks/Quartz.framework/ImageKit.framework
Availability
Available in Mac OS X v10.5 and later.
Declared in
IKImageView.h
Related sample code

Overview

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, 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.

Tasks

Getting and Setting Image View Characteristics

Getting and Setting Images

Manipulating the Image in a View

Working With Core Animation

Scrolling

Converting Points and Rectangles

Properties

For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.

autohidesScrollers

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

@property BOOL autohidesScrollers

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

autoresizes

Specifies the automatic resizing state for the image view.

@property BOOL autoresizes

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

backgroundColor

Specifies the background color for the image view.

@property(assign) NSColor *backgroundColor

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

currentToolMode

Specifies the current tool mode for the image view.

@property(copy) NSString *currentToolMode

Discussion

See “Tool Modes” for possible values.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

delegate

Specifies the delegate object of the receiver.

@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.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

doubleClickOpensImageEditPanel

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

@property BOOL doubleClickOpensImageEditPanel

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

editable

Specifies the editable state for the image view.

@property BOOL editable

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

hasHorizontalScroller

Specifies the horizontal scroll bar state for the image view.

@property BOOL hasHorizontalScroller

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

hasVerticalScroller

Specifies the vertical scroll bar state for the image view.

@property BOOL hasVerticalScroller

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

imageCorrection

Specifies a Core Image filter for image correction.

@property(assign) CIFilter *imageCorrection

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

rotationAngle

Specifies the rotation angle for the image view.

@property CGFloat rotationAngle

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

supportsDragAndDrop

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

@property BOOL supportsDragAndDrop

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

zoomFactor

Specifies the zoom factor for the image view.

@property CGFloat zoomFactor

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

Instance Methods

convertImagePointToViewPoint:

Converts an image coordinate to an image view coordinate.

- (NSPoint)convertImagePointToViewPoint:(NSPoint)imagePoint

Parameters
imagePoint

A point specified in coordinates relative to the image.

Return Value

A point specified in coordinates relative to the image view.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

convertImageRectToViewRect:

Converts an image rectangle to an image view rectangle.

- (NSRect)convertImageRectToViewRect:(NSRect)imageRect

Parameters
imageRect

An rectangle specified in coordinates relative to the image.

Return Value

An rectangle specified in coordinates relative to the image view.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

convertViewPointToImagePoint:

Converts an image view coordinate to an image coordinate.

- (NSPoint)convertViewPointToImagePoint:(NSPoint)viewPoint

Parameters
viewPoint

A point specified in coordinates relative to the image view.

Return Value

The point specified in coordinates relative to the image.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

convertViewRectToImageRect:

Converts an image view rectangle to an image rectangle.

- (NSRect)convertViewRectToImageRect:(NSRect)viewRect

Parameters
viewRect

An rectangle specified in coordinates relative to the image view.

Return Value

The rectangle specified in coordinates relative to the image.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

crop:

Crops the image using the current selection.

- (void)crop:(id)sender

Parameters
sender

Typically the object that invoked this method.

Availability
  • Available in Mac OS X v10.6 and later.
Declared In
IKImageView.h

flipImageHorizontal:

Flips an image along the horizontal axis.

- (void)flipImageHorizontal:(id)sender

Parameters
sender

The object initiating the action.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

flipImageVertical:

Flips an image along the vertical axis.

- (void)flipImageVertical:(id)sender

Parameters
sender

The object initiating the action.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

image

Returns the image associated with the view, after any image corrections.

- (CGImageRef)image

Return Value

The image.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

imageProperties

Returns the metadata for the image in the view.

- (NSDictionary *)imageProperties

Return Value

A dictionary of metadata that specifies the image properties.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

imageSize

Returns the size of the image in the image view.

- (NSSize)imageSize

Return Value

The size of the image.

Discussion

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

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

overlayForType:

Returns the Core Animation layer associated with a layer type.

- (CALayer *)overlayForType:(NSString *)layerType

Parameters
layerType

A layer type. See “Overlay Types”.

Return Value

The Core Animation layer.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

rotateImageLeft:

Rotates the image left (counter-clockwise).

- (void)rotateImageLeft:(id)sender

Parameters
sender

Typically the object that invoked this method.

Availability
  • Available in Mac OS X v10.6 and later.
Declared In
IKImageView.h

rotateImageRight:

Rotates the image right (clockwise).

- (void)rotateImageRight:(id)sender

Parameters
sender

Typically the object that invoked this method.

Availability
  • Available in Mac OS X v10.6 and later.
Declared In
IKImageView.h

scrollToPoint:

Scrolls the view to the specified point.

- (void)scrollToPoint:(NSPoint)point

Parameters
point

The point to scroll to.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

scrollToRect:

Scrolls the view so that it includes the provided rectangular area.

- (void)scrollToRect:(NSRect)rect

Parameters
rect

The rectangular area to include in the view.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

setImage:imageProperties:

Sets the image to display in an image view.

- (void)setImage:(CGImageRef)image imageProperties:(NSDictionary *)metaData

Parameters
image

The image to set.

metaData

A dictionary that contains metadata that describes the image.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

setImageWithURL:

Initializes an image view with the image specified by a URL.

- (void)setImageWithURL:(NSURL *)url

Parameters
url

The URL that specifies the location of the image.

Discussion

This method is the preferred initializer for RAW images. If you use this method for a TIFF file that contains multiple images, only the first image is displayed.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

setImageZoomFactor:centerPoint:

Sets the zoom factor at the provided origin.

- (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.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

setOverlay:forType:

Sets an overlay type for a Core Animation layer.

- (void)setOverlay:(CALayer *)layer forType:(NSString *)layerType

Parameters
layer

A Core Animation layer object.

layerType

A layer type. See “Overlay Types”.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

setRotationAngle:centerPoint:

Sets the rotation angle at the provided origin.

- (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.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

zoomImageToActualSize:

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

- (void)zoomImageToActualSize:(id)sender

Parameters
sender

The object initiating the action.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

zoomImageToFit:

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

- (void)zoomImageToFit:(id)sender

Parameters
sender

The object initiating the action.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

zoomImageToRect:

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

- (void)zoomImageToRect:(NSRect)rect

Parameters
rect

The rectangle to fit the image in.

Availability
  • Available in Mac OS X v10.5 and later.
Declared In
IKImageView.h

zoomIn:

Zooms the image in.

- (void)zoomIn:(id)sender

Parameters
sender

Typically the object that invoked this method.

Availability
  • Available in Mac OS X v10.6 and later.
Declared In
IKImageView.h

zoomOut:

Zooms the image out.

- (void)zoomOut:(id)sender

Parameters
sender

Typically the object that invoked this method.

Availability
  • Available in Mac OS X v10.6 and later.
Declared In
IKImageView.h

Constants

Tool Modes

Image Kit tools modes referenced by the currentToolMode property.

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.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

IKToolModeMove

The move tool.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

IKToolModeSelect

The selection tool.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

IKToolModeSelectRect

Same as IKToolModeSelect.

Available in Mac OS X v10.6 and later.

Declared in IKImageView.h.

IKToolModeSelectEllipse

The selection ellipse.

Available in Mac OS X v10.6 and later.

Declared in IKImageView.h.

IKToolModeSelectLasso

The selection lasso.

Available in Mac OS X v10.6 and later.

Declared in IKImageView.h.

IKToolModeCrop

The crop tool.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

IKToolModeRotate

The rotation tool.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

IKToolModeAnnotate

The annotation tool.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

Declared In
IKImageView.h

Overlay Types

A layer level.

NSString *const IKOverlayTypeBackground;
NSString *const IKOverlayTypeImage;
Constants
IKOverlayTypeBackground

A background.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

IKOverlayTypeImage

An image.

Available in Mac OS X v10.5 and later.

Declared in IKImageView.h.

Declared In
IKImageView.h



Last updated: 2010-05-25

Did this document help you? Yes It's good, but... Not helpful...