5

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

4

1 回答 1

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];
}
于 2012-09-01T20:08:24.557 回答