如何从UICollectionView过渡到像Pinterest/Evernote的UIViewController [英] How to transition from UICollectionView to UIViewController like Pinterest/Evernote

查看:152
本文介绍了如何从UICollectionView过渡到像Pinterest/Evernote的UIViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UICollectionView并且当选择了一个项目,我想它动画全屏.因此它将从单元格的大小过渡到全屏,并成为UIViewController. Pinterest和Evernote都具有这种行为,点击单元格会将其转换为全屏视图控制器.

I have a UICollectionView and when an item is selected, I'd like it to animate full screen. So it would transition from the size of the cell to full screen and become a UIViewController. Pinterest and Evernote both have this behavior where tapping on a cell transitions the cell into a full screen view controller.

有什么例子可以做到这一点吗?我已经搜索了多个项目,但没有找到任何有关将单元格转换为全屏视图控制器的说明.

Are there any example of how this is done? I've searched several projects, but haven't found any illustrating on transitioning a cell to full screen view controller.

Pinterest在这里讨论: https://medium.com/@Pinterest_Engineering/behind-the-pins-building-pinterest-3-0-for-ios-100f57f6940

Pinterest discusses it here: https://medium.com/@Pinterest_Engineering/behind-the-pins-building-pinterest-3-0-for-ios-100f57f6940

推荐答案

实现此过渡并不难.就像文章所说的那样,他们自定义了一个过渡来实现UIViewControllerAnimatedTransitioning协议,除此之外没有其他内容.您需要计算新的大小,然后点击要设置动画的imageView的位置.就是这样.

It's not difficult to implement this transition. Just like the article said, they custom a transition to implement UIViewControllerAnimatedTransitioning protocol, nothing besides. You need to calculate the new size the position which imageView you tapped to animate. That's it.

这两个应用程序都通过上述方法实现了类似的过渡效果.

This our two apps, all implement this similar transition effect by this method above.

https://itunes.apple.com /app/hua-ban-quan-qiu-you-mei-tu/id494813494?mt = 8

还有一个:

https://itunes.apple.com /app/mei-tu-sou-sou-wan-zhuan-wei/id781146829?mt = 8

几天前,我已经创建了这个回购.在Swift的帮助下,我几乎完成了一些小问题的过渡,这是我第一个基于Swift的实践演示项目.但是,如果您不是iOS开发人员的新生,并且要学习Swift BTW,就不难理解.我将完成并稍后修复错误.

I'd created this repo several days before. And with Swift, I almost finished this transition beside some little issue, this is my first practised demo project based Swift. But it's not hard to understand if you're not freshman in iOS dev and you'd learn Swift BTW. I'll finish it and fix the bugs later.

在实际项目中,它比演示项目要复杂得多,但是,也许您已经知道如何实现这种过渡.

In real project it's more complex than the demo one, but with that, maybe you'd knew how to achieve this kind of transition.

祝你好运.

这篇关于如何从UICollectionView过渡到像Pinterest/Evernote的UIViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆