【问题标题】:UIPageViewController partial curl from code代码中的 UIPageViewController 部分卷曲
【发布时间】:2012-08-27 04:33:18
【问题描述】:

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

【问题讨论】:

  • 你发现了什么有用的东西?

标签: iphone ios xcode uipageviewcontroller


【解决方案1】:

您需要使用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];
}

【讨论】:

  • 这根本不是我想要的。我想弯曲页面以反映它可以通过滑动手势进行更改。我不想用一些动画来改变视图。
  • 我也想要这个! UIViewAnimationTransitionCurlUp 没有解决这个问题。也许有一些方法可以伪造 GestureRecognizers 以进行过渡?
猜你喜欢
  • 1970-01-01
  • 2012-01-21
  • 1970-01-01
  • 1970-01-01
  • 2015-12-12
  • 1970-01-01
  • 1970-01-01
  • 2013-10-21
  • 1970-01-01
相关资源
最近更新 更多