0

我在 iCarousel 类的反射视图中有一个 UIProgressView 对象

当我尝试更新 ProgressView 时,它没有更新

使用委托方法更新进度视图即时消息

当图像的下载完成时,我会像这样调用委托方法

if([viewdelegate respondsToSelector:@selector(DidFinishprocess:tag:)])
{
     [viewdelegate DidFinishprocess:value tag:bookid];
}

在另一边更新进度条即时执行此方法

-(void)DidFinishprocess:(float)progress tag:(int)bookid
{
NSArray *arr = carousel.visibleItemViews; //carousel.visibleItemViews;
    for (UIView *vi in arr)
    {
        if ([vi isKindOfClass:[ReflectionView class]])
        {
             if (vi.tag == bookid)
             {

                 for (UIProgressView *v in vi.subviews)
                 {
                      if ([v isKindOfClass:[UIProgressView class]])
                      {
                            progressView = (UIProgressView*)v;
                            [progressView setProgress:progress animated:YES];
                            NSLog(@"%f",progress);

                            //Here i m getting the new value of progress bar but the progress view doesn't how the update                                                                       

                            progressView=nil;
                            break;
                      }
                  }
               }

            }
        }
 } 
4

1 回答 1

0
- (void)DidFinishprocess:(float)progress tag:(int)bookid
{ 
    //code  ...

    [progressView setProgress:progress animated:YES];

    //code  ...
}

分配progress变量的值必须是float

UIProgressBar 值范围从 0.0 (0%) 到 1.0 (100%)

您的值应该以分数递增,例如 0.1、0.2、0.3 等。例如:

[progressView setProgress:bytesReceived/bytesTotal animated:YES];

如果您得到的值progress介于 0 到 100 之间(例如 10、11、12...),那么您必须将其设为分数,除以 100:

[progressView setProgress:progress/100 animated:YES];
于 2013-06-20T06:42:44.390 回答