是否可以翻转关于x或y轴的UIView,以便它完全翻转,你可以看到视图的“背面”?我认为UIKit基于OpenGL ES,因此存在使用双面三角形实现图层的问题......
答案 0 :(得分:2)
要翻转到视图控制器:
viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:viewController animated:YES completion:nil];
要摆脱它:
[self dismissViewControllerAnimated:YES completion:nil];
如果您只想翻转视图,可以将想要翻转的两个视图放在一个大小相同的未命名视图中,并链接IBOutlet UIView * newView,* oldView;视图并将新视图放在顶部
bool a = NO;
@implementation ViewController
- (IBAction)flip:(id)sender
{
if (a == NO) {
[UIView transitionFromView:oldView toView:newView
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:NULL];
a = YES; // a = !a;
}
else {
[UIView transitionFromView:newView toView:oldView
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:NULL];
a = NO; // a = !a;
}
}
来源:How to flip an individual UIView (without flipping the parent view)
您可以检查这个很棒的自定义控制器: