Display UIProgressView with percentage in iOS

寵の児 提交于 2019-12-14 02:39:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!