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:
UIProgressViewStyleDefaultThis is the default style of the progress view. An example of this is the progress view shown in Figure 2-74.
UIProgressViewStyleBarThis is similar to the
UIProgressViewStyleDefaultbut is meant to be used for progress views that are to be added to a toolbar.
An instance of UIProgressView ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access