You are on page 1of 10

UIProgressView Class Reference

Contents

UIProgressView Class Reference 3


Overview 3 Tasks 4 Initializing the UIProgressView Object 4 Managing the Progress Bar 4 Configuring the Progress Bar 4 Properties 4 progress 4 progressImage 5 progressTintColor 5 progressViewStyle 6 trackImage 6 trackTintColor 6 Instance Methods 7 initWithProgressViewStyle: 7 setProgress:animated: 7 Constants 8 UIProgressViewStyle 8

Document Revision History 9

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

UIProgressView Class Reference

Inherits from Conforms to

UIView : UIResponder : NSObject NSCoding NSCoding (UIView) UIAppearance (UIView) UIAppearanceContainer (UIView) NSObject (NSObject)

Framework Availability Declared in Related sample code

/System/Library/Frameworks/UIKit.framework Available in iOS 2.0 and later. UIProgressView.h

AVMovieExporter AVSimpleEditoriOS DownloadFont UICatalog

Overview
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 its downloading messages. The UIProgressView class provides properties for managing the style of the progress bar and for getting and setting values that are pinned to the progress of a task. For an indeterminate progress indicatoror, informally, a spinneruse an instance of the UIActivityIndicatorView class.

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

UIProgressView Class Reference Tasks

Tasks
Initializing the UIProgressView Object
initWithProgressViewStyle:

(page 7) Initializes and returns an progress-view object.

Managing the Progress Bar


progress

(page 4) property The current progress shown by the receiver. (page 7) Adjusts the current progress shown by the receiver, optionally animating the change.

setProgress:animated:

Configuring the Progress Bar


progressViewStyle

(page 6) property The current graphical style of the receiver. (page 5) property The color shown for the portion of the progress bar that is filled. (page 5) property An image to use for the portion of the progress bar that is filled. (page 6) property The color shown for the portion of the progress bar that is not filled. (page 6) property An image to use for the portion of the track that is not filled.

progressTintColor

progressImage

trackTintColor

trackImage

Properties
progress
The current progress shown by the receiver.

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

UIProgressView Class Reference Properties

@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. Availability Available in iOS 2.0 and later.
Related Sample Code

AVMovieExporter Declared in

UIProgressView.h

progressImage
An image to use for the portion of the progress bar that is filled.
@property(nonatomic, retain) UIImage *progressImage

Discussion If you provide a custom image, the progressTintColor (page 5) property is ignored. Availability Available in iOS 5.0 and later. Declared in
UIProgressView.h

progressTintColor
The color shown for the portion of the progress bar that is filled.
@property(nonatomic, retain) UIColor *progressTintColor

Availability Available in iOS 5.0 and later. Declared in


UIProgressView.h

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

UIProgressView Class Reference Properties

progressViewStyle
The current graphical style of the receiver.
@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 (page 8). For more on these constants, see UIProgressViewStyle (page 8). Availability Available in iOS 2.0 and later. Declared in
UIProgressView.h

trackImage
An image to use for the portion of the track that is not filled.
@property(nonatomic, retain) UIImage *trackImage

Discussion If you provide a custom image, the trackTintColor (page 6) property is ignored. Availability Available in iOS 5.0 and later. Declared in
UIProgressView.h

trackTintColor
The color shown for the portion of the progress bar that is not filled.
@property(nonatomic, retain) UIColor *trackTintColor

Availability Available in iOS 5.0 and later. Declared in


UIProgressView.h

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

UIProgressView Class Reference Instance Methods

Instance Methods
initWithProgressViewStyle:
Initializes and returns an progress-view object.
- (id)initWithProgressViewStyle:(UIProgressViewStyle)style

Parameters
style

A constant that specifies the style of the object to be created. See UIProgressViewStyle (page 8) for descriptions of the style constants. Return Value An initialized UIProgressView object or nil if the object couldnt 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 (page 6) property. Availability Available in iOS 2.0 and later. Declared in
UIProgressView.h

setProgress:animated:
Adjusts the current progress shown by the receiver, optionally animating the change.
- (void)setProgress:(float)progress animated:(BOOL)animated

Parameters
progress

The new progress value.


animated YES if the change should be animated, NO 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.

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

UIProgressView Class Reference Constants

Availability Available in iOS 5.0 and later. Declared in


UIProgressView.h

Constants
UIProgressViewStyle
The styles permitted for the progress bar.

typedef enum { UIProgressViewStyleDefault, UIProgressViewStyleBar, } UIProgressViewStyle;

Constants
UIProgressViewStyleDefault

The standard progress-view style. This is the default. Available in iOS 2.0 and later. Declared in UIProgressView.h.
UIProgressViewStyleBar

The style of progress view that is used in a toolbar. Available in iOS 2.0 and later. Declared in UIProgressView.h. Discussion You can set and retrieve the current style of progress view through the progressViewStyle (page 6) property. Availability Available in iOS 2.0 and later. Declared in
UIProgressView.h

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

Document Revision History

This table describes the changes to UIProgressView Class Reference .

Date 2011-10-12 2008-05-28

Notes Updated for iOS 5. New document that describes the class for depicting the progress of a task over time.

2011-10-12 | Copyright 2011 Apple Inc. All Rights Reserved.

Apple Inc. Copyright 2011 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, mechanical, electronic, photocopying, recording, or otherwise, without prior written permission of Apple Inc., with the following exceptions: Any person is hereby authorized to store documentation on a single computer for personal use only and to print copies of documentation for personal use provided that the documentation contains Apples copyright notice. No licenses, express or implied, are granted with respect to any of the technology described in this document. Apple retains all intellectual property rights associated with the technology described in this document. This document is intended to assist application developers to develop applications only for Apple-labeled computers. Apple Inc. 1 Infinite Loop Cupertino, CA 95014 408-996-1010 Apple and the Apple logo are trademarks of Apple Inc., registered in the U.S. and other countries. iOS is a trademark or registered trademark of Cisco in the U.S. and other countries and is used under license.
Even though Apple has reviewed this document, APPLE MAKES NO WARRANTY OR REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS DOCUMENT, ITS QUALITY, ACCURACY, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. AS A RESULT, THIS DOCUMENT IS PROVIDED AS IS, AND YOU, THE READER, ARE ASSUMING THE ENTIRE RISK AS TO ITS QUALITY AND ACCURACY. IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OR INACCURACY IN THIS DOCUMENT, even if advised of the possibility of such damages. THE WARRANTY AND REMEDIES SET FORTH ABOVE ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL OR WRITTEN, EXPRESS OR IMPLIED. No Apple dealer, agent, or employee is authorized to make any modification, extension, or addition to this warranty. Some states do not allow the exclusion or limitation of implied warranties or liability for incidental or consequential damages, so the above limitation or exclusion may not apply to you. This warranty gives you specific legal rights, and you may also have other rights which vary from state to state.

You might also like