Next Page > Hide TOC

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

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 2.0 Programming Language.

autohidesScrollers

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

@property BOOL autohidesScrollers;

Availability
Declared In
IKImageView.h

autoresizes

Specifies the automatic resizing state for the image view.

@property BOOL autoresizes;

Availability
Declared In
IKImageView.h

backgroundColor

Specifies the background color for the image view.

@property NSColor *  backgroundColor;

Availability
Declared In
IKImageView.h

currentToolMode

Specifies the current tool mode for the image view.

@property NSString*  currentToolMode;

Availability
Declared In
IKImageView.h

delegate

Specifies the delegate object of the receiver.

@property 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
Declared In
IKImageView.h

doubleClickOpensImageEditPanel

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

@property BOOL doubleClickOpensImageEditPanel;

Availability
Declared In
IKImageView.h

editable

Specifies the editable state for the image view.

@property BOOL editable;

Availability
Declared In
IKImageView.h

hasHorizontalScroller

Specifies the horizontal scroll bar state for the image view.

@property BOOL hasHorizontalScroller;

Availability
Declared In
IKImageView.h

hasVerticalScroller

Specifies the vertical scroll bar state for the image view.

@property BOOL hasVerticalScroller;

Availability
Declared In
IKImageView.h

imageCorrection

Specifies a Core Image filter for image correction.

@property CIFilter * imageCorrection;

Availability
Declared In
IKImageView.h

rotationAngle

Specifies the rotation angle for the image view.

@property CGFloat rotationAngle;

Availability
Declared In
IKImageView.h

supportsDragAndDrop

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

@property BOOL supportsDragAndDrop;

Availability
Declared In
IKImageView.h

zoomFactor

Specifies the zoom factor for the image view.

@property CGFloat zoomFactor;

Availability
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
See Also
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
See Also
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
See Also
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
See Also
Declared In
IKImageView.h

flipImageHorizontal:

Flips an image along the horizontal axis.

- (void)flipImageHorizontal: (id)sender;

Parameters
sender

The object initiating the action.

Availability
See Also
Declared In
IKImageView.h

flipImageVertical:

Flips an image along the vertical axis.

- (void)flipImageVertical: (id)sender;

Parameters
sender

The object initiating the action.

Availability
See Also
Declared In
IKImageView.h

image

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

- (CGImageRef)image;

Return Value

The image.

Availability
See Also
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
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
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
See Also
Declared In
IKImageView.h

scrollToPoint:

Scrolls the view to the specified point.

- (void)scrollToPoint:(NSPoint)point;

Parameters
point

The point to scroll to.

Availability
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
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
See Also
Declared In
IKImageView.h

Constants

Tool Modes

Image Kit tools modes.

NSString *const IKToolModeMove;
NSString *const IKToolModeSelect;
NSString *const IKToolModeCrop;
NSString *const IKToolModeRotate;
NSString *const IKToolModeAnnotate;

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

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

Next Page > Hide TOC


© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-04-08)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.