问题
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