【发布时间】:2012-08-27 04:33:18
【问题描述】:
是否有可能使用 UIPageViewController 从代码中部分卷曲页面。我想向用户展示他能够更改页面,为此我想部分卷曲页面并将其放回原处(向左然后向右轻轻滑动,这将是用户获得此效果的输入但我想从代码中获得它)。
【问题讨论】:
-
你发现了什么有用的东西?
标签: iphone ios xcode uipageviewcontroller
是否有可能使用 UIPageViewController 从代码中部分卷曲页面。我想向用户展示他能够更改页面,为此我想部分卷曲页面并将其放回原处(向左然后向右轻轻滑动,这将是用户获得此效果的输入但我想从代码中获得它)。
【问题讨论】:
标签: iphone ios xcode uipageviewcontroller
您需要使用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];
}
【讨论】: