仅翻转动画UIVIEW

时间:2015-05-13 10:57:29

标签: ios xcode uiviewanimation

Hello Danny its your 6

我创建了两个视图并建立了IBOutlet连接。我尝试了一个简单的翻转动画。我试过的只是翻转动画UIView.but整个VIEW CONTROLLER是动画。

1 个答案:

答案 0 :(得分:1)

我从here为您提供了代码,如果您需要更多参考,请参阅该链接

UIView *fromView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,  containerView.frame.size.width, containerView.frame.size.height)];
fromView.backgroundColor = [UIColor blueColor];
UIView *toView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerView.frame.size.width, containerView.frame.size.height)];
toView.backgroundColor = [UIColor purpleColor];
[containerView addSubview:fromView];

[CATransaction flush];

[UIView transitionFromView:fromView toView:toView duration:0.4f options:UIViewAnimationOptionTransitionFlipFromLeft completion:NULL];