NSImageCell Class Reference

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

Overview

An NSImageCell object displays a single image (encapsulated in an NSImage object) in a frame. This class provides methods for choosing the frame and for aligning and scaling the image to fit the frame.

The object value of an NSImageCell object must be an NSImage object, so if you use the setObjectValue: method of NSCell, be sure to supply an NSImage object as an argument. Because an NSImage object does not need to be converted for display, do not use the NSCell methods relating to formatters.

An NSImageCell object is usually associated with some kind of control object. For example, an NSMatrix or an NSTableView.

Designated Initializers

When subclassing NSImageCell you must implement all of the designated initializers. Those methods are: init, initWithCoder:, initTextCell:, and initImageCell:.

Tasks

Aligning and Scaling the Image

Choosing the Frame

Instance Methods

imageAlignment

Returns the alignment of the receiver’s image relative to its frame.

- (NSImageAlignment)imageAlignment
Return Value

One of the image alignment constants. For a list of possible values, see NSImageAlignment. The default value is NSImageAlignCenter.

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

imageFrameStyle

Returns the style of the frame that borders the image.

- (NSImageFrameStyle)imageFrameStyle
Return Value

One of the frame style constants. For a list of frame styles, see NSImageFrameStyle. The default value is NSImageFrameNone.

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

imageScaling

Returns the scaling mode used to fit the receiver's image into the frame.

- (NSImageScaling)imageScaling
Return Value

One of the image scaling constants. For a list of possible values, see NSImageScaling. The default value is NSImageScaleProportionallyDown.

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

setImageAlignment:

Sets the alignment of the image in its frame.

- (void)setImageAlignment:(NSImageAlignment)alignment
Parameters
alignment

One of the image alignment constants. For a list of possible values, see NSImageAlignment.

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

setImageFrameStyle:

Sets the style of the frame that borders the image.

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

One of the frame style constants. For a list of frame styles, see NSImageFrameStyle.

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

setImageScaling:

Sets the scaling mode used to fit the receiver's image into the frame.

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

One of the image scaling constants. For a list of possible values, see NSImageScaling.

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

Constants

NSImageAlignment

These constants allow you to specify the location of the image in the frame and are used by imageAlignment and setImageAlignment:.

enum {
   NSImageAlignCenter = 0,
   NSImageAlignTop,
   NSImageAlignTopLeft,
   NSImageAlignTopRight,
   NSImageAlignLeft,
   NSImageAlignBottom,
   NSImageAlignBottomLeft,
   NSImageAlignBottomRight,
   NSImageAlignRight
};
typedef NSUInteger NSImageAlignment;
Constants
NSImageAlignCenter

Center the image in the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignTop

Position the image along the top edge of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignTopLeft

Align the image with the top and left edges of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignTopRight

Align the image with the top and right edges of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignLeft

Align the image with the left edge of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignBottom

Align the image with the bottom edge of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignBottomLeft

Align the image with the bottom and left edges of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignBottomRight

Align the image with the bottom and right edges of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageAlignRight

Position the image along the right edge of the cell.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

Declared In
NSImageCell.h

NSImageFrameStyle

These constants allow you to specify the kind of frame bordering the image and are used by imageFrameStyle and setImageFrameStyle:. Note that some of these constants are stylistically obsolete and should be considered deprecated.

enum {
   NSImageFrameNone = 0,
   NSImageFramePhoto,
   NSImageFrameGrayBezel,
   NSImageFrameGroove,
   NSImageFrameButton
};
typedef NSUInteger NSImageFrameStyle;
Constants
NSImageFrameNone

An invisible frame

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageFramePhoto

A thin black outline and a dropped shadow. (Deprecated. This constant is stylistically obsolete and should be considered deprecated.)

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageFrameGrayBezel

A gray, concave bezel that makes the image look sunken.

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageFrameGroove

A thin groove that looks etched around the image. (Deprecated. This constant is stylistically obsolete and should be considered deprecated.)

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

NSImageFrameButton

A convex bezel that makes the image stand out in relief, like a button. (Deprecated. This constant is stylistically obsolete and should be considered deprecated.)

Available in OS X v10.0 and later.

Declared in NSImageCell.h.

Declared In
NSImageCell.h