在segue之后继续更新进度条

时间:2015-04-28 00:23:50

标签: ios objective-c iphone ipad

我的应用内部只有一个WebViewController和一个WebView,WebView的内容使用实现MenuViewController的{​​{1}}进行了更改。

SWRevealViewController内启动下载任务时,我想显示ViewController以显示进度并继续更新,即使用户从菜单中选择了其他项目。

问题是,每次选择菜单项时,progressView都会返回0,并且不再更新。

progressView
WebViewController.m
- (void) startDownload:(NSString*)manyURLS {
    NSLog(@"Downloading...");
    self.progressView.hidden = NO;
    //download the files in a seperate thread.
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        NSError *error = nil; //error setting
        NSString *index;
        int numItems;
        float progress;

        for (int i = 1; i <= numItems; i++) {
        // download url item           

            NSLog(@"%f", progress);
            progress = (double)i/(double)numItems;

            dispatch_async(dispatch_get_main_queue(), ^{
                self.progressView.progress = progress;
            });
        }

        //saving is done on main thread
        dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"Download Finished !");
            self.progressView.hidden = YES;
        });
    });
}
MenuViewController.m

如何在菜单选项之间导航并在Segue之后继续更新progressView?

0 个答案:

没有答案