2.23. Displaying Progress with UIProgressView
Problem
You want to display a progress bar on the screen, depicting the progress of a certain task, for instance, the progress of downloading a file from a URL.
Solution
Instantiate a view of type UIProgressView
and place it on another
view.
Discussion
A progress view is what programmers generally call a progress bar. An example of a progress view is depicted in Figure 2-74.
Figure 2-74. A simple progress view
Progress views are generally displayed to users to show them the
progress of a task that has a well-defined starting and ending point.
For instance, downloading 30 files is a well-defined task with a
specific starting and ending point. This task obviously finishes when
all 30 files have been downloaded. A progress view is an instance of
UIProgressView
and is initialized
using the designated initializer of this class, the initWithProgressViewStyle:
method. This
method takes in the style of the progress bar to be created as a
parameter. This parameter is of type UIProgressViewStyle
and can therefore be one
of the following values:
UIProgressViewStyleDefault
This is the default style of the progress view. An example of this is the progress view shown in Figure 2-74.
UIProgressViewStyleBar
This is similar to the
UIProgressViewStyleDefault
but is meant to be used for progress views that are to be added to a toolbar.
An instance of UIProgressView ...
Get iOS 5 Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.