我的应用内部只有一个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?