我有两个值targetValue和receivedValue。现在我想在进度条上显示状态。意味着如果targetValue是1000,receivedValue是500,那么进度条应该显示50%的填充区域。
所以我想知道有没有什么简单的方法…或者我必须计算任何必须用myProgressBar.progress = value设置的值?
发布于 2011-04-08 18:05:09
在下面使用
myProgressBar.progress = receivedValue /targetValue ;receivedValue /targetValue的取值范围为0.0 ~ 1.0;
发布于 2011-04-08 17:58:52
如果是这样,你必须计算值并传递它。
myProgressBar.progress = value发布于 2011-09-23 18:59:28
下面是我推荐的解决方案:
-(void)UpdateProgressbar:(NSNumber*)currentOperationNumer TotalOperationNumber:(NSNumber*)n
{
NSLog(@" operation : %i", currentOperationNumer);
NSLog(@" total : %i", n);
NSString *inStr = [NSString stringWithFormat:@"%d", n];
NSLog(@"%@", inStr);
NSString *Str = [NSString stringWithFormat:@"%d", currentOperationNumer];
NSLog(@"%@", Str);
if (currentOperationNumer <= n) {
[downloadBar setProgress:([Str intValue]/[inStr floatValue])];
NSLog(@"progress !");
}
else {
[self.view removeFromSuperview];
}
}https://stackoverflow.com/questions/5593412
复制相似问题