Mac Developer Library

Developer

AppKit Framework Reference NSImageCell Class Reference

Options
Deployment Target:

On This Page
Language:

NSImageCell

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

Inheritance


  • NSObject
  • NSCell
  • NSImageCell
  • IOBluetoothAccessibilityIgnoredImageCell
  • NSObject
  • NSCell
  • NSImageCell
  • IOBluetoothAccessibilityIgnoredImageCell

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.
  • Returns the alignment of the receiver’s image relative to its frame.

    Declaration

    Swift

    var imageAlignment: NSImageAlignment

    Objective-C

    @property NSImageAlignment imageAlignment

    Return Value

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the alignment of the image in its frame.

    Declaration

    Swift

    var imageAlignment: NSImageAlignment

    Objective-C

    @property NSImageAlignment imageAlignment

    Parameters

    alignment

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var imageScaling: NSImageScaling

    Objective-C

    @property NSImageScaling imageScaling

    Return Value

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    var imageScaling: NSImageScaling

    Objective-C

    @property NSImageScaling imageScaling

    Parameters

    scaling

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the style of the frame that borders the image.

    Declaration

    Swift

    var imageFrameStyle: NSImageFrameStyle

    Objective-C

    @property NSImageFrameStyle imageFrameStyle

    Return Value

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the style of the frame that borders the image.

    Declaration

    Swift

    var imageFrameStyle: NSImageFrameStyle

    Objective-C

    @property NSImageFrameStyle imageFrameStyle

    Parameters

    frameStyle

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    enum NSImageAlignment : UInt { case AlignCenter case AlignTop case AlignTopLeft case AlignTopRight case AlignLeft case AlignBottom case AlignBottomLeft case AlignBottomRight case AlignRight }

    Objective-C

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

    Constants

    • AlignCenter

      NSImageAlignCenter

      Center the image in the cell.

      Available in OS X v10.0 and later.

    • AlignTop

      NSImageAlignTop

      Position the image along the top edge of the cell.

      Available in OS X v10.0 and later.

    • AlignTopLeft

      NSImageAlignTopLeft

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

      Available in OS X v10.0 and later.

    • AlignTopRight

      NSImageAlignTopRight

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

      Available in OS X v10.0 and later.

    • AlignLeft

      NSImageAlignLeft

      Align the image with the left edge of the cell.

      Available in OS X v10.0 and later.

    • AlignBottom

      NSImageAlignBottom

      Align the image with the bottom edge of the cell.

      Available in OS X v10.0 and later.

    • AlignBottomLeft

      NSImageAlignBottomLeft

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

      Available in OS X v10.0 and later.

    • AlignBottomRight

      NSImageAlignBottomRight

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

      Available in OS X v10.0 and later.

    • AlignRight

      NSImageAlignRight

      Position the image along the right edge of the cell.

      Available in OS X v10.0 and later.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    enum NSImageFrameStyle : UInt { case None case Photo case GrayBezel case Groove case Button }

    Objective-C

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

    Constants

    • None

      NSImageFrameNone

      An invisible frame

      Available in OS X v10.0 and later.

    • Photo

      NSImageFramePhoto

      A thin black outline and a dropped shadow.

      This constant is stylistically obsolete and should be considered deprecated.

      Available in OS X v10.0 and later.

    • GrayBezel

      NSImageFrameGrayBezel

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

      Available in OS X v10.0 and later.

    • Groove

      NSImageFrameGroove

      A thin groove that looks etched around the image.

      This constant is stylistically obsolete and should be considered deprecated.

      Available in OS X v10.0 and later.

    • Button

      NSImageFrameButton

      A convex bezel that makes the image stand out in relief, like a button.

      This constant is stylistically obsolete and should be considered deprecated.

      Available in OS X v10.0 and later.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.