问题
How can I display a UIProgressView
with a percentage?
回答1:
As Vlad mentioned you can have a method which updates the value of progressView and its associated label. Call the following method when any update happens.
- (void)updateProgress
{
CGFloat stepSize = 0.1f;
[self.progressView setProgress:self.progressView.progress+stepSize];
self.progressLabel.text = [NSString stringWithFormat:@"Completed : %.0f",self.progressView.progress*100];
}
回答2:
The progress indicator control does not offer the option of also displaying progress percent. In order to achieve this, one solution would be to add a label positioned below / above your progress bar, and at each step when you refresh the progress on your progress indicator view, you also update the string value in on your label to display the percentage loaded.
回答3:
There is one widget already available in iOS SDK - UIProgressView
Where you can set and get its property: progress
Hope this may help you.
来源:https://stackoverflow.com/questions/15200982/display-uiprogressview-with-percentage-in-ios