UIImageView * frontImageView = [[UIImageView alloc] initWithImage:[UIImage
                                                                   imageNamed:@"view.png"]];

UIView * containerView = [[UIView alloc] initWithFrame:frontImageView.bounds];
containerView.center = self.view.center;

[self.view addSubview:containerView];
[containerView addSubview:frontImageView];

UIImageView * backImageView = [[UIImageView alloc] initWithImage:[UIImage
                                                                  imageNamed:@"view.png"]];
backImageView.center = frontImageView.center;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
                       forView:containerView
                         cache:YES];
[frontImageView removeFromSuperview];
[containerView addSubview:backImageView];
[UIView commitAnimations];

我想翻转 containerView,但它不起作用。

最佳答案

This 是关于同一问题的类似帖子。 @Jason Harwig 建议您尝试:



编辑: 看着 another post ,似乎在提交动画之前添加 subview 是问题所在。你为什么不试试呢?

希望有帮助!

关于iphone - 如何从左翻转?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7315892/

10-12 14:31