UIPageViewController只有一个内容视图控制器 [英] UIPageViewController with only one content view controller

查看:230
本文介绍了UIPageViewController只有一个内容视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有webView的应用程序和一些用于呈现文本的JS技巧。分页在JS中实现,我只是将事件从手势传递到JS函数。
但我想念的是动画。知道用户在用滑动翻页时只看到文本的另一部分。
所以我决定使用UIPageViewController。我需要显示一个控制器,它会在转动动画期间改变它的状态。因此每次都会返回相同的一个

I have an app with webView and some JS-tricks to present text. Paging is implemented in JS and I just pass events from gestures to JS functions. But what I miss is animation. Know user just see another portion of text when he turns the page with swipe. So I decided to use UIPageViewController. I need a one controller to be shown and it will change it state during animation of turning. So the same one will be returned every time in

-(UIViewController*) pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController  

- (UIViewController*) pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController

现在我在执行此操作时出错。

Now I have an error doing this.

最后,问题 - 在pageViewController中只能使用一个控制器进行正确的动画吗?

Finally, the question - can only one controller be used for proper animation in pageViewController?

推荐答案

您可以使用 UIView transitionWithView:方法来动画内容更改并添加卷曲动画就像这样:

You can use UIView's transitionWithView: method to animate content changes and add a curl animation just like this:

    [UIView transitionWithView:self.view
                      duration:0.5
                       options:UIViewAnimationOptionTransitionCurlUp
                    animations:^{
                        // change your content here
                    }
                    completion:^(BOOL finished) {
                        // optional completion block
                    }];

这篇关于UIPageViewController只有一个内容视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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