The progress view looked more three-dimensional in iOS 6:
AppDelegate
:
unchanged.
ViewController
calls the
setProgress
method of the
View
every second until the progress view is full.
View
A
UIProgressView
looks like horizontal thermometer with blue mercury.
You could make it vertical with the
CGAffineTransformMakeRotation
we saw
here,
but don’t do it—everyone expects the progress view
to be horizontal.
It fills from left
CGAffineTransformMakeScale
,
but don’t do it—everyone expects the progress view
to fill from left to right.
(What about Arabic and Hebrew?)
You could change the color with
progressTintColor
and
trackTintColor
,
but don’t do it—everyone expects the progress view
to be blue on gray.
Don’t specify a height for the
UIProgressView
;
it defaults to 2 pairs of pixels on iPhone 6.
Two ways to set the level of mercury:
progress
property of the progress view.
setProgress(_:animated:)
method of the progress view.
See Progress View in the Human Interface Guidelines.
Unlike the
NSTimer
in the
Activity
app, the timer in this app
is set to
repeats:
true
.
The infinite loop is broken when the
setProgress
View
invalidate
s
the timer.
label.font = UIFont(name: "Courier", size: UIFont.labelFontSize()); //three spaces before the first zero label.text = "Downloading 0 of 100";Update it to
label.text = String(format: "Downloading %3d of %3d", Int(100 * progressView.progress), 100);
NSTimer
in
Switch
to update a time display while the music is playing?