Why we are using UIProgressView ??
UIProgressView depicts the progress of a task over time. 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. Values less than 0.0 and greater than 1.0 are pinned to those limits.
OutPut of Progress view(below image)
Programmatically create a UIProgress view control
UIProgressView *progressView = [[UIProgressView alloc] init];
progressView.frame = CGRectMake(100,100,100,20);
[progressView setProgressTintColor:[UIColor redColor]];
[progressView setUserInteractionEnabled:NO];
progressView.progress=0.5f;
[progressView setProgressViewStyle:UIProgressViewStyleBar];
[progressView setTrackTintColor:[UIColor blueColor]];
// OR
// [progressView setTrackImage:[UIImage imageNamed:@"logo.png"]];
[self.view addSubview:progressView];
Below contents are from Apple Docs
For an indeterminate progress indicator—or, informally, a “spinner”—use an instance of the
Below contents are from Apple Docs
Overview
You use the
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.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 indicator—or, informally, a “spinner”—use an instance of the
UIActivityIndicatorView
class.Tasks:
Initializing the UIProgressView Object
Managing the Progress Bar
-
progress
property -
– setProgress:animated:
Configuring the Progress Bar
-
progressViewStyle
property -
progressTintColor
property -
progressImage
property -
trackTintColor
property -
trackImage
property
Properties
progress
The current progress shown by the receiver.
@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.
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, theprogressTintColor
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
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 isUIProgressViewStyleDefault
. For more on these constants, see UIProgressViewStyle
.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, thetrackTintColor
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
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
for descriptions of the style constants.
Return Value
An initializedUIProgressView
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.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.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 inUIProgressView.h
. UIProgressViewStyleBar
- The style of progress view that is used in a toolbar.
Available in iOS 2.0 and later.
Declared inUIProgressView.h
.
Discussion
You can set and retrieve the current style of progress view through theprogressViewStyle
property.Availability
- Available in iOS 2.0 and later.
Declared In
UIProgressView.h
No comments:
Post a Comment