iOS Developer Library

Developer

UIKit Framework Reference UIProgressView Class Reference

Options
Deployment Target:

On This Page
Language:

UIProgressView

You use the UIProgressView class to depict the progress of a task over time. An example of a progress bar is the one shown at the bottom of the Mail application when it’s downloading messages. More...

Inheritance


Import Statement


import UIKit @import UIKit;

Availability


Available in iOS 2.0 and later.
  • Initializes and returns an progress-view object.

    Declaration

    Swift

    init(progressViewStyle style: UIProgressViewStyle)

    Objective-C

    - (instancetype)initWithProgressViewStyle:(UIProgressViewStyle)style

    Parameters

    style

    A constant that specifies the style of the object to be created. See UIProgressViewStyle for descriptions of the style constants.

    Return Value

    An initialized UIProgressView object or nil if the object couldn’t be created.

    Discussion

    UIProgressView sets the height of the returned view according to the specified style. You can set and retrieve the style of a progress view through the progressViewStyle property.

    Import Statement

    import UIKit

    Availability

    Available in iOS 2.0 and later.

  • progress progress Property

    The current progress shown by the receiver.

    Declaration

    Swift

    var progress: Float

    Objective-C

    @property(nonatomic) float progress

    Discussion

    The current progress is represented by a floating-point value between 0.0 and 1.0, inclusive, where 1.0 indicates the completion of the task. The default value is 0.0. Values less than 0.0 and greater than 1.0 are pinned to those limits.

    Import Statement

    import UIKit

    Availability

    Available in iOS 2.0 and later.

  • Adjusts the current progress shown by the receiver, optionally animating the change.

    Declaration

    Swift

    func setProgress(_ progress: Float, animated animated: Bool)

    Objective-C

    - (void)setProgress:(float)progress animated:(BOOL)animated

    Parameters

    progress

    The new progress value.

    animated

    YEStrue if the change should be animated, NOfalse if the change should happen immediately.

    Discussion

    The current progress is represented by a floating-point value between 0.0 and 1.0, inclusive, where 1.0 indicates the completion of the task. The default value is 0.0. Values less than 0.0 and greater than 1.0 are pinned to those limits.

    Import Statement

    import UIKit

    Availability

    Available in iOS 5.0 and later.

  • The current graphical style of the receiver.

    Declaration

    Swift

    var progressViewStyle: UIProgressViewStyle

    Objective-C

    @property(nonatomic) UIProgressViewStyle progressViewStyle

    Discussion

    The value of this property is a constant that specifies the style of the progress view. The default style is UIProgressViewStyleDefault. For more on these constants, see UIProgressViewStyle.

    Import Statement

    import UIKit

    Availability

    Available in iOS 2.0 and later.

  • The color shown for the portion of the progress bar that is filled.

    Declaration

    Swift

    var progressTintColor: UIColor?

    Objective-C

    @property(nonatomic, retain) UIColor *progressTintColor

    Import Statement

    import UIKit

    Availability

    Available in iOS 5.0 and later.

  • An image to use for the portion of the progress bar that is filled.

    Declaration

    Swift

    var progressImage: UIImage?

    Objective-C

    @property(nonatomic, retain) UIImage *progressImage

    Discussion

    If you provide a custom image, the progressTintColor property is ignored.

    Import Statement

    import UIKit

    Availability

    Available in iOS 5.0 and later.

  • The color shown for the portion of the progress bar that is not filled.

    Declaration

    Swift

    var trackTintColor: UIColor?

    Objective-C

    @property(nonatomic, retain) UIColor *trackTintColor

    Import Statement

    import UIKit

    Availability

    Available in iOS 5.0 and later.

  • An image to use for the portion of the track that is not filled.

    Declaration

    Swift

    var trackImage: UIImage?

    Objective-C

    @property(nonatomic, retain) UIImage *trackImage

    Discussion

    If you provide a custom image, the trackTintColor property is ignored.

    Import Statement

    import UIKit

    Availability

    Available in iOS 5.0 and later.

Data Types

  • The styles permitted for the progress bar.

    Declaration

    Swift

    enum UIProgressViewStyle : Int { case Default case Bar }

    Objective-C

    typedef enum { UIProgressViewStyleDefault, UIProgressViewStyleBar, } UIProgressViewStyle;

    Constants

    • Default

      UIProgressViewStyleDefault

      The standard progress-view style. This is the default.

      Available in iOS 2.0 and later.

    • Bar

      UIProgressViewStyleBar

      The style of progress view that is used in a toolbar.

      Available in iOS 2.0 and later.

    Discussion

    You can set and retrieve the current style of progress view through the progressViewStyle property.

    Import Statement

    import UIKit

    Availability

    Available in iOS 2.0 and later.