UIPageViewController:ViewController之间的淡入/淡出动画吗? [英] UIPageViewController: Fade In/Out Animation Between Viewcontrollers?

查看:130
本文介绍了UIPageViewController:ViewController之间的淡入/淡出动画吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在@ http://www.appcoda.com/uipageviewcontroller-storyboard上关注了该教程-tutorial/来实现UIPageViewController.我需要在视图控制器之间进行过渡,以在用户在它们之间滚动时淡入/淡出.

I followed the tutorial over @ http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/ to implement a UIPageViewController. I need to make the transition between view controllers to fade in/out when the user scrolls between them.

在此处 https://itunes.apple.com/us/app/tapiture/id645402534?mt=8

推荐答案

使用委托pageViewController:willTransitionToViewControllers:.这被称为手势开始时.您知道旧的视图控制器是什么,因为它已经存在.您知道新的视图控制器是什么,因为此消息告诉您.因此,您可以访问他们的视图.因此,您可以更改其视图的alpha.

Use the delegate pageViewController:willTransitionToViewControllers:. This is called as the gesture begins. You know what the old view controller is because it's already there. You know what the new view controller is because this message tells you. Thus you have access to their views. Thus you can change the alpha of their views.

该手势可能已取消,但是pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted:会告诉您这一点,因此您可以重新固定现有视图的alpha.

The gesture may be cancelled, but then pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted: tells you this, so you can fix the alpha of the existing view back again.

如果您不喜欢这种方法,则必须继承UIPageViewController的子类,或者编写自己的父视图控制器来执行相同的操作.这样做的好处是您可以直接访问滚动视图并可以自己跟踪滚动.几年前的WWDC视频中讨论了编写无限滚动视图"的问题.我已经写了一篇,但是当UIPageViewController呈现滚动样式时就放弃了.

If you don't like that approach, you're going to have to subclass UIPageViewController, or write your own parent view controller that does the same sort of thing. The advantage there is that you have direct access to the scroll view and can track the scroll yourself. Writing an "infinite scroll view" is discussed in a WWDC video from some years ago; I've written one, but I abandoned it when UIPageViewController took on the scrolling style.

这篇关于UIPageViewController:ViewController之间的淡入/淡出动画吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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