今天我发现Apple News App 和Pinterest App 的放大效果,我想知道如何实现类似的效果。我读了 Pinterest 的博客 https://engineering.pinterest.com/blog/behind-pins-building-pinterest-30-ios
它说
To do this, we used UINavigationControllerDelegate’s animationControllerForOperation method to provide a UIViewControllerAnimatedTransitioning object to perform the transition
而且我无法弄清楚UIViewControllerAnimatedTransitioning
类型的CBLPinViewTransition
的幕后是什么
看起来我可能需要以编程方式在
func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
// Perform the animation
}
当我实现协议(protocol) UIViewControllerAnimatedTransitioning
和 UIViewControllerTransitioningDelegate
时,如 Mathew 的博客中所述 http://mathewsanders.com/animated-transitions-in-swift/
我的方向是否正确?任何人都可以知道如何实现这一点。
最佳答案
是的,那是正确的道路。在过渡方法中,取原始 block 的帧。获取您要转换到的 View 的快照,并将其添加到框架中的 View 。然后动画其大小变化以填满屏幕。
关于ios - 如何实现类似Apple News App或Pinterest ios的放大效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36961778/