Reputation: 5076
I have an app.
It has VideoListViewController
that has list of videos to download.
When I click the download button, the control is transferred to DetailViewController
.
DetailViewController
shows the download progress and when download gets completed, it plays the video. After download gets completed I changed isDownloaded
to true
, so that next time it shows play button instead of download.
Everything works perfectly if the user don't go to previous VideoListViewController
while video is being downloaded. If it does go back to VideoListController, then I don't know the progress of download, neither when the download gets completed. Since from VideoListController I don't know when the download gets completed, I can't change the download button to play when the download gets completed.
Please help me to know how can one keep track of download progress and download completion event from various controllers or atleast from two different controller.
Do I need to keep the downloading function in AppDelegate
. Please elaborate in detail. I am new to iOS
Upvotes: 0
Views: 135
Reputation: 677
For Tasks like that Apple introduced the NSNotificationcenter.
With this you can make a thread notify different classes when it finished it's execution.
Upvotes: 1