我正在寻找一种在 iPhone 上进行 UIViewAnimationTransitionCurlUp
或 UIViewAnimationTransitionCurlDown
转换的方法,但不是从上到下,而是从左到右(或从上到下)/底部横向模式)。我在互联网上多次看到这个问题,但似乎没有人得到答案。不过我觉得这是可行的。
我尝试更改 View 的变换和 view.layer 的变换,但这并没有影响转换。由于当设备改变方向时过渡会发生变化,我认为有一种方法可以欺骗设备在纵向模式下使用横向过渡,反之亦然?
最佳答案
使用容器 View 可以在四个方向中的任何一个方向上进行 curl 。将容器 View 的转换设置为您想要的角度,然后通过将您的 View 添加到容器 View (而不是没有转换框架的应用程序主视图)来进行 curl :
NSView* parent = viewController.view; // the main view
NSView* containerView = [[[UIView alloc] initWithFrame:parent.bounds] autorelease];
containerView.transform = CGAffineTransformMakeRotation(<your angle here, should probably be M_PI_2 * some integer>);
[parent addSubview:containerView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:containerView cache:YES];
[containerView addSubview:view];
[UIView commitAnimations];
关于iPhone 向左 curl 和向右 curl 过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1625375/