UIPageViewController从代码中部分卷曲

时间:2012-09-01 19:50:25

标签: iphone ios xcode uipageviewcontroller

是否有可能使用UIPageViewController从代码中部分卷曲页面。我想向用户显示他能够更改页面,为了做到这一点,我想部分卷曲页面并将其放回(轻轻向左滑动然后向右,这将是用户输入以获得此效果但我希望它来自代码。)

1 个答案:

答案 0 :(得分:0)

您需要使用UIViewAnimationTransitionCurlUp。查看下面的示例。

- (void)handleSwipe:(UISwipeGestureRecognizer *)sender {

if(sender.state == UIGestureRecognizerStateEnded) {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES];

    [self.view addSubview:[newView view]];
    [oldView removeFromSuperview];

    [UIView commitAnimations];
   }                  
}
- (void)createGestureRecognizers:(UIView *) target {
UISwipeGestureRecognizer *rightSwipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];

[rightSwipeRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[target addGestureRecognizer:rightSwipeRecognizer];
[rightSwipeRecognizer release];
}