Mac Developer Library

Developer

AppKit Framework Reference NSLevelIndicator Class Reference

Options
Deployment Target:

On This Page
Language:

NSLevelIndicator

NSLevelIndicator is a subclass of NSControl that displays a value on a linear scale.

Level indicators provide a visual representation of a level or amount of something, using discrete values. While similar to NSSlider, it provides a more customized visual feedback to the user. Level indicators do not have a “knob” indicating the current setting or allowing the user to adjust settings. The supported indicator styles include:

  • A capacity style level indicator. The continuous mode for this style is often used to indicate conditions such as how much data is on hard disk. The discrete mode is similar to audio level indicators in audio playback applications. You can specify both a warning value and a critical value that provides additional visual feedback to the user.

  • A ranking style level indicator. This is similar to the star ranking displays provided in iTunes and iPhoto. You can also specify your own ranking image.

  • A relevancy style level indicator. This style is used to display the relevancy of a search result, for example in Mail.

NSLevelIndicator uses an NSLevelIndicatorCell to implement much of the control’s functionality. NSLevelIndicator provides cover methods for most of NSLevelIndicatorCell’s methods, which invoke the corresponding cell method.

  • Sets where tick marks appear relative to the receiver.

    Declaration

    Swift

    var tickMarkPosition: NSTickMarkPosition

    Objective-C

    @property NSTickMarkPosition tickMarkPosition

    Discussion

    This method has no effect if no tick marks have been assigned (that is, numberOfTickMarks returns 0).

    Availability

    Available in OS X v10.4 and later.

  • Returns how the receiver’s tick marks are aligned with it.

    Declaration

    Swift

    var tickMarkPosition: NSTickMarkPosition

    Objective-C

    @property NSTickMarkPosition tickMarkPosition

    Discussion

    The default alignments are NSTickMarkBelow and NSTickMarkLeft.

    Availability

    Available in OS X v10.4 and later.

  • Sets the number of tick marks displayed by the receiver (which include those assigned to the minimum and maximum values) to count.

    Declaration

    Swift

    var numberOfTickMarks: Int

    Objective-C

    @property NSInteger numberOfTickMarks

    Discussion

    By default, this value is 0, and no tick marks appear. The number of tick marks assigned to a slider, along with the slider’s minimum and maximum values, determines the values associated with the tick marks.

    Availability

    Available in OS X v10.4 and later.

  • Returns the number of tick marks associated with the receiver.

    Declaration

    Swift

    var numberOfTickMarks: Int

    Objective-C

    @property NSInteger numberOfTickMarks

    Discussion

    The tick marks assigned to the minimum and maximum values are included.

    Availability

    Available in OS X v10.4 and later.

  • Sets the number of major tick marks displayed by the receiver.

    Declaration

    Swift

    var numberOfMajorTickMarks: Int

    Objective-C

    @property NSInteger numberOfMajorTickMarks

    Discussion

    The count must be less than or equal to the number of tick marks returned by numberOfTickMarks. For example, if the number of tick marks is 11 and you specify 3 major tick marks, the resulting level indicator will display 3 major tickmarks alternating with 8 minor tick marks, as in the example shown in Figure 1.

    Figure 1Major and minor tick marks in a level indicator image: Art/disk_space.eps is missing from your submission.

    Availability

    Available in OS X v10.4 and later.

  • Returns the number of major tick marks associated with the receiver.

    Declaration

    Swift

    var numberOfMajorTickMarks: Int

    Objective-C

    @property NSInteger numberOfMajorTickMarks

    Availability

    Available in OS X v10.4 and later.

  • Returns the receiver’s value represented by the tick mark at index (the minimum-value tick mark has an index of 0).

    Declaration

    Swift

    func tickMarkValueAtIndex(_ index: Int) -> Double

    Objective-C

    - (double)tickMarkValueAtIndex:(NSInteger)index

    Availability

    Available in OS X v10.4 and later.

  • Returns the bounding rectangle of the tick mark identified by index (the minimum-value tick mark is at index 0).

    Declaration

    Swift

    func rectOfTickMarkAtIndex(_ index: Int) -> NSRect

    Objective-C

    - (NSRect)rectOfTickMarkAtIndex:(NSInteger)index

    Discussion

    If no tick mark is associated with index, the method raises a NSRangeException.

    Availability

    Available in OS X v10.4 and later.