Mac Developer Library

Developer

AppKit Framework Reference NSProgressIndicator Class Reference

Options
Deployment Target:

On This Page
Language:

NSProgressIndicator

The NSProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way. Some progress indicators are indeterminate and do nothing more than spin to show that the application is busy. Others are determinate and show the percentage of the task that has been completed.

Inheritance


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.
  • animate: - animate: (OS X v10.5) and later

    This action method advances the progress animation of an indeterminate progress animator by one step.

    Deprecation Statement

    NSProgressIndicator no longer supports incrementing the animation using this method. Use the startAnimation: and stopAnimation: methods to perform animation of the progress indicator.

    Declaration

    Objective-C

    - (void)animate:(id)sender

    Parameters

    sender

    The object sending the message.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Deprecated in OS X v10.5 and later.

  • animationDelay - animationDelay (OS X v10.5) and later

    Returns the delay, in seconds, between animation steps for an indeterminate progress indicator.

    Deprecation Statement

    Progress indicators no longer allow the animation delay to be set.

    Declaration

    Objective-C

    - (NSTimeInterval)animationDelay

    Return Value

    The delay between animation steps. By default, the animation delay is set to 1/12 of a second (5.0/60.0). A determinate progress indicator does not use the animation delay value.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Deprecated in OS X v10.5 and later.

  • setAnimationDelay: - setAnimationDelay: (OS X v10.5) and later

    Sets the delay, in seconds, between animation steps for an indeterminate progress indicator.

    Deprecation Statement

    Progress indicators no longer allow the animation delay to be set.

    Declaration

    Objective-C

    - (void)setAnimationDelay:(NSTimeInterval)delay

    Parameters

    delay

    The number of seconds between animation steps. By default, the animation delay is set to 1/12 of a second (5.0/60.0). Setting the delay to a double value larger than 5.0/60.0 slows the animation, while setting the delay to a smaller value speeds it up. A determinate progress indicator does not use the animation delay value.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Deprecated in OS X v10.5 and later.

  • Sets a hint as to whether the receiver should implement animation of the progress indicator in a separate thread.

    Declaration

    Swift

    var usesThreadedAnimation: Bool

    Objective-C

    @property BOOL usesThreadedAnimation

    Parameters

    flag

    YEStrue to indicate that animation of the progress indicator should occur in a separate thread; otherwise, NOfalse. This value is only a hint and may be ignored.

    Discussion

    If the application becomes multithreaded as a result of an invocation of this method, the application’s performance could become noticeably slower.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Starts the animation of an indeterminate progress indicator.

    Declaration

    Swift

    func startAnimation(_ sender: AnyObject?)

    Objective-C

    - (void)startAnimation:(id)sender

    Parameters

    sender

    The object sending the message.

    Discussion

    Does nothing for a determinate progress indicator.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Stops the animation of an indeterminate progress indicator.

    Declaration

    Swift

    func stopAnimation(_ sender: AnyObject?)

    Objective-C

    - (void)stopAnimation:(id)sender

    Parameters

    sender

    The object sending the message.

    Discussion

    Does nothing for a determinate progress indicator.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns whether the receiver implements the animation of the progress indicator in a separate thread.

    Declaration

    Swift

    var usesThreadedAnimation: Bool

    Objective-C

    @property BOOL usesThreadedAnimation

    Return Value

    YEStrue if animation of the progress indicator occurs in a separate thread; otherwise, NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Advances the progress bar of a determinate progress indicator by the specified amount.

    Declaration

    Swift

    func incrementBy(_ delta: Double)

    Objective-C

    - (void)incrementBy:(double)delta

    Parameters

    delta

    The amount by which to increment the progress bar. For example, if you want to advance a progress bar from 0.0 to 100.0 in 20 steps, you would invoke incrementBy: 20 times with a delta value of 5.0.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – doubleValue

  • Sets the value that indicates the current extent of the receiver.

    Declaration

    Swift

    var doubleValue: Double

    Objective-C

    @property double doubleValue

    Parameters

    doubleValue

    The current extent of a determinate progress indicator.

    Discussion

    An indeterminate progress indicator does not use this value.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns a value that indicates the current extent of the progress bar of a determinate progress indicator.

    Declaration

    Swift

    var doubleValue: Double

    Objective-C

    @property double doubleValue

    Return Value

    The value representing the current extent of a determinate progress bar. For example, a determinate progress indicator goes from 0.0 to 100.0 by default. If the progress bar has advanced halfway across the view, the value returned by doubleValue would be 50.0. An indeterminate progress indicator does not use this value.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the minimum value for the receiver.

    Declaration

    Swift

    var minValue: Double

    Objective-C

    @property double minValue

    Parameters

    newMinimum

    The minimum value of the progress indicator. An indeterminate progress indicator does not use this value.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – minValue

  • Returns the minimum value for the progress bar of a determinate progress indicator.

    Declaration

    Swift

    var minValue: Double

    Objective-C

    @property double minValue

    Return Value

    The minimum value of the progress indicator. By default, a determinate progress indicator goes from 0.0 to 100.0, so the value returned would be 0.0. An indeterminate progress indicator does not use this value.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the maximum value for the receiver.

    Declaration

    Swift

    var maxValue: Double

    Objective-C

    @property double maxValue

    Parameters

    newMaximum

    The maximum value of the progress indicator. An indeterminate progress indicator does not use this value.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – maxValue

  • Returns the maximum value for the progress bar of a determinate progress indicator.

    Declaration

    Swift

    var maxValue: Double

    Objective-C

    @property double maxValue

    Return Value

    The maximum value of the progress indicator. By default, a determinate progress indicator goes from 0.0 to 100.0, so the value returned would be 100.0. An indeterminate progress indicator does not use this value.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the size of the receiver.

    Declaration

    Swift

    var controlSize: NSControlSize

    Objective-C

    @property NSControlSize controlSize

    Parameters

    size

    A constant indicating the size of the control. Valid values for size are described in NSCell.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – controlSize

  • Returns the size of the receiver.

    Declaration

    Swift

    var controlSize: NSControlSize

    Objective-C

    @property NSControlSize controlSize

    Return Value

    A constant indicating the size of the control. Valid return values are described in NSCell.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s control tint.

    Declaration

    Swift

    var controlTint: NSControlTint

    Objective-C

    @property NSControlTint controlTint

    Parameters

    controlTint

    A constant indicating the desired control tint. Valid values for controlTint are described in NSCell.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – controlTint

  • Returns the receiver’s control tint.

    Declaration

    Swift

    var controlTint: NSControlTint

    Objective-C

    @property NSControlTint controlTint

    Return Value

    A constant indicating the current control tint. Valid return values are described in NSCell.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver’s frame has a three-dimensional bezel.

    Declaration

    Swift

    var bezeled: Bool

    Objective-C

    @property(getter=isBezeled) BOOL bezeled

    Parameters

    flag

    YEStrue if the progress indicator is bezeled; otherwise, NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – isBezeled

  • isBezeled - isBezeled Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value indicating whether the receiver's frame has a bezel.

    Declaration

    Objective-C

    - (BOOL)isBezeled

    Return Value

    YEStrue if the receiver’s frame has a three-dimensional bezel; otherwise, NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 through OS X v10.9.

    See Also

    – setBezeled:

  • Sets whether the receiver is indeterminate.

    Declaration

    Swift

    var indeterminate: Bool

    Objective-C

    @property(getter=isIndeterminate) BOOL indeterminate

    Parameters

    flag

    YEStrue if the progress indicator should be indeterminate; otherwise NOfalse.

    Discussion

    This method only has an effect if style returns NSProgressIndicatorBarStyle. If style returns NSProgressIndicatorSpinningStyle, the indicator is always indeterminate, regardless of what you pass to this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isIndeterminate - isIndeterminate Available in OS X v10.0 through OS X v10.9

    Returns a Boolean value indicating whether the receiver is indeterminate.

    Declaration

    Objective-C

    - (BOOL)isIndeterminate

    Return Value

    YEStrue if the progress bar is indeterminate; otherwise NOfalse. This applies only if style returns NSProgressIndicatorBarStyle.

    Discussion

    If style returns NSProgressIndicatorSpinningStyle, the indicator is always indeterminate, regardless of what this method returns.

    A determinate indicator displays how much of the task has been completed. An indeterminate indicator shows simply that the application is busy.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • Sets the style of the progress indicator (bar or spinning).

    Declaration

    Swift

    var style: NSProgressIndicatorStyle

    Objective-C

    @property NSProgressIndicatorStyle style

    Parameters

    style

    A constant indicating the style of the progress indicator. Possible values for style are described in NSProgressIndicatorStyle.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.2 and later.

    See Also

    – style

  • Returns the style of the progress indicator (bar or spinning).

    Declaration

    Swift

    var style: NSProgressIndicatorStyle

    Objective-C

    @property NSProgressIndicatorStyle style

    Return Value

    A constant indicating the style of the progress indicator. Possible return values are described in NSProgressIndicatorStyle.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.2 and later.

    See Also

    – setStyle:

  • This action method resizes the receiver to an appropriate size depending on what style returns.

    Declaration

    Swift

    func sizeToFit()

    Objective-C

    - (void)sizeToFit

    Discussion

    Use this after you use setStyle: to re-size the receiver.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.2 and later.

  • Sets whether the receiver hides itself when it isn’t animating.

    Declaration

    Swift

    var displayedWhenStopped: Bool

    Objective-C

    @property(getter=isDisplayedWhenStopped) BOOL displayedWhenStopped

    Parameters

    isDisplayed

    YEStrue to hide the progress indicator when it isn't animating; otherwise NOfalse. By default, this is YEStrue if style is NSProgressIndicatorBarStyle, and NOfalse if style is NSProgressIndicatorSpinningStyle.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.2 and later.

  • isDisplayedWhenStopped - isDisplayedWhenStopped Available in OS X v10.2 through OS X v10.9

    Returns a Boolean value indicating whether the receiver shows itself even when it’s not animating.

    Declaration

    Objective-C

    - (BOOL)isDisplayedWhenStopped

    Return Value

    YEStrue if the progress indicator shows itself even when it’s not animating. By default, this returns returns YEStrue if style is NSProgressIndicatorBarStyle and NOfalse if style isNSProgressIndicatorSpinningStyle.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.2 through OS X v10.9.

Data Types

  • Specify the height of a progress indicator.

    Declaration

    Swift

    enum NSProgressIndicatorThickness : UInt { case PreferredThickness case PreferredSmallThickness case PreferredLargeThickness case PreferredAquaThickness }

    Objective-C

    typedef enum _NSProgressIndicatorThickness { NSProgressIndicatorPreferredThickness = 14, NSProgressIndicatorPreferredSmallThickness = 10, NSProgressIndicatorPreferredLargeThickness = 18, NSProgressIndicatorPreferredAquaThickness = 12 } NSProgressIndicatorThickness;

    Constants

    • PreferredThickness

      NSProgressIndicatorPreferredThickness

      14

      Available in OS X v10.0 and later.

    • PreferredSmallThickness

      NSProgressIndicatorPreferredSmallThickness

      10

      Available in OS X v10.0 and later.

    • PreferredLargeThickness

      NSProgressIndicatorPreferredLargeThickness

      18

      Available in OS X v10.0 and later.

    • PreferredAquaThickness

      NSProgressIndicatorPreferredAquaThickness

      12

      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.

  • Specify the progress indicator’s style and are used by style and setStyle:.

    Declaration

    Swift

    enum NSProgressIndicatorStyle : UInt { case BarStyle case SpinningStyle }

    Objective-C

    typedef enum _NSProgressIndicatorStyle { NSProgressIndicatorBarStyle = 0, NSProgressIndicatorSpinningStyle = 1 } NSProgressIndicatorStyle;

    Constants

    • BarStyle

      NSProgressIndicatorBarStyle

      A rectangular indicator that can be determinate or indeterminate.

      Available in OS X v10.2 and later.

    • SpinningStyle

      NSProgressIndicatorSpinningStyle

      A small square indicator that can be indeterminate only .

      Available in OS X v10.2 and later.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.2 and later.