- Inherits from:
- NSControl : NSView : NSResponder : NSObject
- Conforms to:
- NSCoding
- (NSResponder)
- NSObject (NSObject)
Declared in:
- AppKit/NSImageView.h
An NSImageView displays a single NSImage in a frame. The NSImageView class provides methods for choosing the image, choosing the frame, and for aligning and scaling the image to fit the frame.
For an NSControl, NSImageView is quite limited in its ability to respond to user events: the only thing a user can do is drag in a new image. When it receives the new image, the NSImageView replaces its old image and sends its action message to its target. Even this low level of interactivity can be disabled: you can send the NSImageView the message setEditable: with an argument of NO.
For more information, see the class specification for NSImageCell.
- Choosing the image
- - image
- - setImage:
- Choosing the frame
- - imageFrameStyle
- - setImageFrameStyle:
- Aligning and scaling the image
- - imageAlignment
- - setImageAlignment:
- - imageScaling
- - setImageScaling:
- Responding to user events
- - isEditable
- - setEditable:
- (NSImage *)image
See Also: - setImage:
- (NSImageAlignment)imageAlignment
- (NSImageFrameStyle)imageFrameStyle
- (NSImageScaling)imageScaling
- (BOOL)isEditable
See Also: - setEditable:
- (void)setEditable:(BOOL)flag
See Also: - isEditable
- (void)setImage:(NSImage
*)image
See Also: - image
- (void)setImageAlignment:(NSImageAlignment)alignment
NSImageAlignLeft
NSImageAlignRight
NSImageAlignCenter
NSImageAlignTop
NSImageAlignBottom
NSImageAlignTopLeft
NSImageAlignTopRight
NSImageAlignBottomLeft
NSImageAlignBottomRight
The
default alignment is NSImageAlignCenter
.
See Also: - imageAlignment
- (void)setImageFrameStyle:(NSImageFrameStyle)frameStyle
NSImageFrameNone
-an
invisible frameNSImageFramePhoto
-a thin
black outline and a dropped shadowNSImageFrameGrayBezel
-a gray,
concave bezel that makes the image look sunkenNSImageGroove
-a thin groove
that looks etched around the imageNSImageFrameButton
-a convex
bezel that makes the image stand out in relief, like a buttonThe
default frameStyle is NSImageFrameNone
.
See Also: - imageFrameStyle
- (void)setImageScaling:(NSImageScaling)scaling
NSScaleProportionally
.
If the image is too large, it shrinks to fit inside the frame. If
the image is too small, it expands. The proportions of the image
are preserved.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.The
default scaling is NSScaleProportionally
.
See Also: - imageScaling