NSImageView Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSImageView.h
Related sample code

Overview

An NSImageView object displays a single image from an NSImage object in a frame and can optionally allow a user to drag an image to it.

Tasks

Choosing the Image

Choosing the Frame

Aligning and Scaling the Image

Responding to User Events

Animating Image Playback

Pasteboard Support

Instance Methods

allowsCutCopyPaste

Returns a Boolean value indicating whether the receiver allows the user to cut, copy and paste of the image contents.

- (BOOL)allowsCutCopyPaste
Return Value

YES if the user can cut, copy, and paste the image contents; otherwise, NO.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSImageView.h

animates

Returns a Boolean value indicating whether the receiver automatically plays animated images.

- (BOOL)animates
Return Value

YES if the receiver automatically plays animated images; otherwise, NO. The default value is YES for NSImageView objects you create programmatically. For NSImageView objects loaded from a nib file, the control takes the value set in Interface Builder.

Discussion

The timing and looping characteristics of the animation are taken from the image data. If this method returns NO, the receiver displays the first frame of the animation only.

Availability
  • Available in OS X v10.3 and later.
Declared In
NSImageView.h

image

Returns the NSImage object displayed by the receiver.

- (NSImage *)image
Return Value

The NSImage object.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSImageView.h

imageAlignment

Returns the position of the cell’s image in the frame.

- (NSImageAlignment)imageAlignment
Return Value

The image alignment. For a list of possible alignments, see setImageAlignment:. The default value is NSImageAlignCenter.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSImageView.h

imageFrameStyle

Returns the style of frame that appears around the image.

- (NSImageFrameStyle)imageFrameStyle
Return Value

The current image style. For a list of frame styles, see setImageFrameStyle:. The default value is NSImageFrameNone.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSImageView.h

imageScaling

Returns the way the cell’s image alters to fit the frame.

- (NSImageScaling)imageScaling
Return Value

The scaling option. For a list of possible values, see setImageScaling:. The default value is NSScaleProportionally.

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSImageView.h

isEditable

Returns a Boolean value indicating whether the user can drag a new image into the frame.

- (BOOL)isEditable
Return Value

YES if the user can drag an image into the receiver's frame; otherwise, NO. The default value is YES.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSImageView.h

setAllowsCutCopyPaste:

Sets whether the receiver allows the user to cut, copy and paste the image contents.

- (void)setAllowsCutCopyPaste:(BOOL)allow
Parameters
allow

YES if the user can cut, copy, and paste the image contents; otherwise, NO to prevent the use of pasteboard operations.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSImageView.h

setAnimates:

Sets whether the receiver automatically plays an animated image that is assigned to it.

- (void)setAnimates:(BOOL)flag
Parameters
flag

YES if the receiver should automatically plays animated images; otherwise, NO.

Discussion

The timing and looping characteristics of the animation are taken from the image data. If you specify NO, the receiver displays the first frame of the animation only.

Availability
  • Available in OS X v10.3 and later.
See Also
Declared In
NSImageView.h

setEditable:

Sets whether the user can drag a new image into the frame.

- (void)setEditable:(BOOL)flag
Parameters
flag

YES if the user can drag an image into the receiver's frame; otherwise, NO.

Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSImageView.h

setImage:

Sets the image of the receiver.

- (void)setImage:(NSImage *)image
Parameters
image

The image to display in the receiver.

Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSImageView.h

setImageAlignment:

Sets the position of the image in the frame.

- (void)setImageAlignment:(NSImageAlignment)alignment
Availability
  • Available in OS X v10.0 and later.
Related Sample Code
Declared In
NSImageView.h

setImageFrameStyle:

Sets the kind of frame that borders the image.

- (void)setImageFrameStyle:(NSImageFrameStyle)frameStyle
Parameters
frameStyle

The possible values for this parameter are as follows:

Availability
  • Available in OS X v10.0 and later.
Declared In
NSImageView.h

setImageScaling:

Sets the way the image alters to fit the frame.

- (void)setImageScaling:(NSImageScaling)scaling
Parameters
scaling

The possible values for this parameter are:

  • NSScaleProportionally. If the image is too large, it shrinks to fit inside the frame. The proportions of the image are preserved. The image is never scaled up to fit a larger frame.

  • NSScaleToFit. The image shrinks or expands, and its proportions distort, until it exactly fits the frame.

  • NSScaleNone. The size and proportions of the image don’t change. If the frame is too small to display the whole image, the edges of the image are trimmed off.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSImageView.h

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