Next Page > Hide TOC

NSProgressIndicator Class Reference

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

Overview

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.

Tasks

Animating the Progress Indicator

Advancing the Progress Bar

Setting the Appearance

Instance Methods

controlSize

Returns the size of the receiver.

- (NSControlSize)controlSize

Return Value

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

Availability
See Also
Declared In
NSProgressIndicator.h

controlTint

Returns the receiver’s control tint.

- (NSControlTint)controlTint

Return Value

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

Availability
See Also
Declared In
NSProgressIndicator.h

doubleValue

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

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

Availability
See Also
Declared In
NSProgressIndicator.h

incrementBy:

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

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

Availability
See Also
Declared In
NSProgressIndicator.h

isBezeled

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

- (BOOL)isBezeled

Return Value

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

Availability
See Also
Declared In
NSProgressIndicator.h

isDisplayedWhenStopped

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

- (BOOL)isDisplayedWhenStopped

Return Value

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

Availability
See Also
Declared In
NSProgressIndicator.h

isIndeterminate

Returns a Boolean value indicating whether the receiver is indeterminate.

- (BOOL)isIndeterminate

Return Value

YES if the progress bar is indeterminate; otherwise NO. 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.

Availability
See Also
Declared In
NSProgressIndicator.h

maxValue

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

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

Availability
See Also
Declared In
NSProgressIndicator.h

minValue

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

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

Availability
See Also
Declared In
NSProgressIndicator.h

setBezeled:

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

- (void)setBezeled:(BOOL)flag

Parameters
flag

YES if the progress indicator is bezeled; otherwise, NO.

Availability
See Also
Declared In
NSProgressIndicator.h

setControlSize:

Sets the size of the receiver.

- (void)setControlSize:(NSControlSize)size

Parameters
size

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

Availability
See Also
Declared In
NSProgressIndicator.h

setControlTint:

Sets the receiver’s control tint.

- (void)setControlTint:(NSControlTint)controlTint

Parameters
controlTint

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

Availability
See Also
Declared In
NSProgressIndicator.h

setDisplayedWhenStopped:

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

- (void)setDisplayedWhenStopped:(BOOL)isDisplayed

Parameters
isDisplayed

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

Availability
See Also
Declared In
NSProgressIndicator.h

setDoubleValue:

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

- (void)setDoubleValue:(double)doubleValue

Parameters
doubleValue

The current extent of a determinate progress indicator.

Discussion

An indeterminate progress indicator does not use this value.

Availability
See Also
Related Sample Code
Declared In
NSProgressIndicator.h

setIndeterminate:

Sets whether the receiver is indeterminate.

- (void)setIndeterminate:(BOOL)flag

Parameters
flag

YES if the progress indicator should be indeterminate; otherwise NO.

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.

Availability
See Also
Declared In
NSProgressIndicator.h

setMaxValue:

Sets the maximum value for the receiver.

- (void)setMaxValue:(double)newMaximum

Parameters
newMaximum

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

Availability
See Also
Declared In
NSProgressIndicator.h

setMinValue:

Sets the minimum value for the receiver.

- (void)setMinValue:(double)newMinimum

Parameters
newMinimum

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

Availability
See Also
Declared In
NSProgressIndicator.h

setStyle:

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

- (void)setStyle:(NSProgressIndicatorStyle)style

Parameters
style

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

Availability
See Also
Declared In
NSProgressIndicator.h

setUsesThreadedAnimation:

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

- (void)setUsesThreadedAnimation:(BOOL)flag

Parameters
flag

YES to indicate that animation of the progress indicator should occur in a separate thread; otherwise, NO. 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.

Availability
See Also
Related Sample Code
Declared In
NSProgressIndicator.h

sizeToFit

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

- (void)sizeToFit

Discussion

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

Availability
Declared In
NSProgressIndicator.h

startAnimation:

Starts the animation of an indeterminate progress indicator.

- (void)startAnimation:(id)sender

Parameters
sender

The object sending the message.

Discussion

Does nothing for a determinate progress indicator.

Availability
See Also
Related Sample Code
Declared In
NSProgressIndicator.h

stopAnimation:

Stops the animation of an indeterminate progress indicator.

- (void)stopAnimation:(id)sender

Parameters
sender

The object sending the message.

Discussion

Does nothing for a determinate progress indicator.

Availability
See Also
Related Sample Code
Declared In
NSProgressIndicator.h

style

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

- (NSProgressIndicatorStyle)style

Return Value

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

Availability
See Also
Declared In
NSProgressIndicator.h

usesThreadedAnimation

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

- (BOOL)usesThreadedAnimation

Return Value

YES if animation of the progress indicator occurs in a separate thread; otherwise, NO.

Availability
See Also
Declared In
NSProgressIndicator.h

Constants

NSProgressIndicatorThickness

Specify the height of a progress indicator.

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

Constants
NSProgressIndicatorPreferredThickness

14

Available in Mac OS X v10.0 and later.

Declared in NSProgressIndicator.h.

NSProgressIndicatorPreferredSmallThickness

10

Available in Mac OS X v10.0 and later.

Declared in NSProgressIndicator.h.

NSProgressIndicatorPreferredLargeThickness

18

Available in Mac OS X v10.0 and later.

Declared in NSProgressIndicator.h.

NSProgressIndicatorPreferredAquaThickness

12

Available in Mac OS X v10.0 and later.

Declared in NSProgressIndicator.h.

Availability
Declared In
NSProgressIndicator.h

NSProgressIndicatorStyle

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

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

Constants
NSProgressIndicatorBarStyle

A rectangular indicator that can be determinate or indeterminate.

Available in Mac OS X v10.2 and later.

Declared in NSProgressIndicator.h.

NSProgressIndicatorSpinningStyle

A small square indicator that can be indeterminate only .

Available in Mac OS X v10.2 and later.

Declared in NSProgressIndicator.h.

Availability
Declared In
NSProgressIndicator.h

Next Page > Hide TOC


© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-03-11)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.