让页面卷曲动画变得简单:
CATransition *transition = [CATransition animation];
[transition setDelegate:self];
[transition setDuration:0.5f];
[transition setType:@"pageCurl"];
[transition setSubtype:landscape ? @"fromBottom" : @"fromRight"];
[self.view.layer addAnimation:transition forKey:@"CurlAnim"];
然而,我的老板希望我在风景中从中间转向(如在iBooks中)。我不能使用UIPageViewController
,因为我还需要以纵向滚动两页,以及在横向和滚动中一次放大两页。有办法做到这一点吗?现在它只是像整个巨型景观页面一样卷曲整个视图。由于它使用两层,我怀疑有一个简单的方法,但我想我会问。
答案 0 :(得分:1)
你不能在UIScrollerView中使用UIPageViewController吗?
这样做可以放大/缩小两个页面。
唯一的问题是,除非您有zoom = 1
,否则无法更改页面答案 1 :(得分:0)
还在考虑这个,如果强制UIPageViewController在横向和纵向中显示2个页面,并将其放在UIScrollerView中。 当你在横向时它显示2页,缩放和按预期工作。 如果你是肖像,你可以使UIPageViewController frame.width成为单个页面的两倍,而UIScrollerView contentSize与UIPageViewController的宽度相同,但UIScrollerView框架的宽度与页面的宽度相同。这样做只显示一个页面,可以滚动到第二个页面。我已经测试并且在横向上工作正常,但是在纵向上有一些问题,滑动到更改页面不能从内部工作,但这可以从外部工作(这就是为什么我设置_zoomer.frame = CGRectMake(10,10,widht) ,高度),在UIPageViewController周围有一个10点框架从那里滑动),点击更改页面也可以。
我在屏幕旋转时使用的代码,仅适用于iPad。
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
CGRect pageViewRect;
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
pageViewRect = CGRectMake(0,0,1496,984);
_zoomer.contentSize=CGSizeMake(1496, 984);
_zoomer.frame = CGRectMake(10,10,748,984);
self.pageViewController.view.frame = pageViewRect;
} else {
pageViewRect = CGRectMake(0,0,1004,728);
_zoomer.frame = CGRectMake(10,10,1004,728);
_zoomer.contentSize=CGSizeMake(1004, 728);
self.pageViewController.view.frame = pageViewRect;
}
}
_zoomer是UIScrollerView