UIPageViewController with only one content view controller

安稳与你 提交于 2019-12-11 14:41:08

问题


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  

and

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

Now I have an error doing this.

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


回答1:


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
                    }];



回答2:


It seems to me you actually want to use a simple UIScrollView with pagingEnabled. Maybe you confused UIPageViewController with UIPageControl?



来源:https://stackoverflow.com/questions/9015370/uipageviewcontroller-with-only-one-content-view-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!