简体   繁体   English

如何快速实现类似于Dropbox的进度视图?

[英]How do I achieve this Dropbox like progress view in swift?

the Dropbox iOS app has a really cool sort of view hierarchy where, when a row is selected from their "Files" tableView, it segues into a view that shows the loading progress of the selected file, then that view transitions into the PDF reader where the file is read/viewed. Dropbox iOS应用程序的视图层次结构非常酷,在该层次结构中,从“文件” tableView中选择一行时,它会筛选到一个视图,以显示所选文件的加载进度,然后该视图转换为PDF阅读器,文件被读取/查看。

The video in this link shows exactly what I mean. 链接中的视频准确显示了我的意思。 Its like the progress view transitions into the PDF view rather then segue to it, because as you can see from the video, when you press the back navigation item from the PDF reader, it goes right back to the tableView, not the progress screen. 就像进度视图过渡到PDF视图,而不是切换到它一样,因为从视频中可以看到,当您从PDF阅读器中按向后导航项时,它将直接返回tableView,而不是进度屏幕。 How do they get this effect? 他们如何获得这种效果? How would I implement it myself? 我如何自己实施?

Three controllers (master view -> progress view -> pdf reader) is possible ... you'd need to intercept the tap on the back button, and instead of going one step back (to the progress view) you'd want to step back two controllers. 三个控制器(母版视图- >发展观- > pdf阅读器)是可能的 ......你需要拦截上的后退按钮水龙头,而不是前进了一大步回(到进度视图),你会想后退两个控制器。

But you'd be fighting iOS the whole way and giving yourself a headache. 但是您会一直在与iOS斗争,这会让您头疼。

Dropbox probably have two controllers master view -> detail view and follow some logic like this: Dropbox可能有两个控制器主视图 -> 详细视图,并遵循一些逻辑,如下所示:

  • viewWillAppear of the detail view they probably set up the progress view that occupies the full width and height of the screen. 在详细视图的viewWillAppear上,他们可能会设置进度视图,该视图占据屏幕的整个宽度和高度。

  • viewDidLoad of the detail view start the animation of the progress view. 详细视图的viewDidLoad启动进度视图的动画。

  • start download of the PDF file and update the progress indicator as it's downloaded. 开始下载PDF文件,并在下载时更新进度指示器。

  • when fully downloaded add it to the view (but below the progress indicator) 完全下载后,将其添加到视图中(但在进度指示器下方)

  • then hide the progress view to show the PDF view underneath. 然后隐藏进度视图以在下面显示PDF视图。

Hope that gives you some ideas about how to create that effect. 希望能给您一些有关如何产生这种效果的想法。

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

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