Type Method

progressWithTotalUnitCount:

Creates and returns an NSProgress instance, initialized using initWithParent:userInfo:.

Declaration

+ (NSProgress *)progressWithTotalUnitCount:(int64_t)unitCount;

Parameters

unitCount

The total number of units of work to be carried out.

Discussion

The initializer is passed the current progress object, if there is one, and the value of the totalUnitCount property is set.

In many cases you can simply precede code that does a substantial amount of work with an invocation of this method, then repeatedly set the completedUnitCount or cancelled property in the loop that does the work.

You can invoke this method on one thread and then message the returned NSProgress on another thread. For example, you can capture the created progress instance in a block that you pass to dispatch_async. In that block you can invoke methods like becomeCurrentWithPendingUnitCount: or resignCurrent, and set the completedUnitCount or cancelled properties as work is carried out.

See Also

Creating Progress Objects

- initWithParent:userInfo:

Initializes a newly allocated NSProgress instance.

+ discreteProgressWithTotalUnitCount:

Creates and returns an NSProgress instance with the specified totalUnitCount that is not part of any existing progress tree. The instance is initialized using initWithParent:userInfo: with the parent set to nil.

+ progressWithTotalUnitCount:parent:pendingUnitCount:

Creates and returns an NSProgress instance attached to the specified parent with the totalUnitCount set to portionOfParentTotalUnitCount.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software