我看过一些关于如何在 iOS 上实现页面卷曲效果的库(例如https://github.com/brow/leaves )。
但这些仅限于 pdf、图像或 coregraphics 绘图。我想要实现的是一个页面应该被一个自定义视图替换(比如一个包含几个按钮的视图、一个 imageview、一个 UITableView 等)。
现在我的问题是我们如何为一组不同的自定义视图(来自不同的视图控制器)设置页面卷曲效果?
我看过一些关于如何在 iOS 上实现页面卷曲效果的库(例如https://github.com/brow/leaves )。
但这些仅限于 pdf、图像或 coregraphics 绘图。我想要实现的是一个页面应该被一个自定义视图替换(比如一个包含几个按钮的视图、一个 imageview、一个 UITableView 等)。
现在我的问题是我们如何为一组不同的自定义视图(来自不同的视图控制器)设置页面卷曲效果?
SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
[sampleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:sampleView animated:YES];
看一下transitionFromView
和transitionWithView
中的方法UIView
:
[UIView transitionWithView:containerView
duration:0.2
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[fromView removeFromSuperview];
[containerView addSubview:toView];
}
completion:NULL
];
该options
参数可以设置为UIViewAnimationOptionTransitionCurlUp
/ UIViewAnimationOptionTransitionCurlDown
。
不确定你想达到什么目标?它是像地图应用程序那样在卷曲的角落后面带有控件的模态对话框,还是像 iBooks 那样的全书式页面卷曲?
第一次看史蒂夫乔布斯的答案(从没想过我会这么说),后者可以完成UIPageViewController
(看这里从 UIPageViewController 开始)。