简体   繁体   English

下载进度未在所有视图中显示ios

[英]Download Progress not displaying in all views ios

In my project user can download movies(nearly 1GB). 在我的项目中,用户可以下载电影(近1GB)。

If clicks on download button he is redirected to Download ViewController, there if clicks start download the download will starts and display progress bar here. 如果单击下载按钮,他将被重定向到Download ViewController,如果单击开始下载,下载将开始并在此处显示进度条。 Upto here there are no issues for me 到目前为止,对我来说没有问题

Problem - But when he clicks on back button(i had write Dismiss ViewController for back action) downloading process is going on normally, but i am unable to show the Download progress in any other view. 问题 -但是,当他单击“后退”按钮(我为后退动作编写了Dismiss ViewController)时,下载过程正常进行,但是我无法在任何其他视图中显示下载进度。

How could i show the download progress from any view. 我如何从任何角度显示下载进度。 Note:- I didn't use Navigation controller for all tabs, i have used it only some tabs. 注意:-我没有对所有标签使用导航控制器,仅对某些标签使用了导航控制器。

Please help me on this... 请帮我...

Thank you 谢谢

If you allocate the download logic in the VC when you dismiss the VC all the download logic is deallocated too. 如果在关闭VC时在VC中分配下载逻辑,则所有下载逻辑也会被释放。

You need to create some subscription-based observing downloader singleton. 您需要创建一些基于订阅的观察下载器单例。

And in every view you want to track the progress you can subscribe in the viewWillAppear (and unsubscribe in viewWillDisappear ). 而且,在每个要跟踪进度的视图中,都可以在viewWillAppear订阅(并在viewWillDisappear退订)。 Then with KVO or NSNotification, for example, you can track the progress. 然后,例如,使用KVO或NSNotification,您可以跟踪进度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM