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 the NSLevelIndicatorCell methods, which invoke the corresponding cell method.

  • The receiver’s minimum value.

    Declaration

    Swift

    var minValue: Double

    Objective-C

    @property double minValue

    Availability

    Available in OS X v10.4 and later.

  • The receiver’s maximum value.

    Declaration

    Swift

    var maxValue: Double

    Objective-C

    @property double maxValue

    Availability

    Available in OS X v10.4 and later.

  • The receiver’s warning value.

    Declaration

    Swift

    var warningValue: Double

    Objective-C

    @property double warningValue

    Availability

    Available in OS X v10.4 and later.

  • The receiver’s critical value.

    Declaration

    Swift

    var criticalValue: Double

    Objective-C

    @property double criticalValue

    Availability

    Available in OS X v10.4 and later.

  • Determines 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. This property has no effect if no tick marks have been assigned (that is, numberOfTickMarks returns 0).

    Availability

    Available in OS X v10.4 and later.

  • The number of tick marks associated with the receiver.

    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.

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

    Declaration

    Swift

    var numberOfMajorTickMarks: Int

    Objective-C

    @property NSInteger numberOfMajorTickMarks

    Discussion

    The number of major tick marks 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 tick marks alternating with 8 minor tick marks, as in the example shown in Figure 2-3.

    Figure 1Major and minor tick marks in a level indicator image: ../Art/disk_space.pdf

    Availability

    Available in OS X v10.4 and later.

  • Returns the receiver’s value represented by the tick mark at the specified 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 the specified 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 an NSRangeException.

    Availability

    Available in OS X v10.4 and later.

  • The appearance of the indicator.

    Declaration

    Swift

    var levelIndicatorStyle: NSLevelIndicatorStyle

    Objective-C

    @property NSLevelIndicatorStyle levelIndicatorStyle

    Discussion

    See NSLevelIndicatorStyle for possible styles.

    Availability

    Available in OS X v10.10 and later.