我有4个UIView类型的子视图,它是在主视图中添加的。我想用光滑的翻转动画来翻转这些视图。我试过了,但没能成功地完成。这是我用过的代码。
setAnimationTransition:UIViewAnimationTransitionFlipFromRight入门动画:零上下文:NULL;UIView设置动画描述:0.5;UIView UIView forView:signUpView缓存:YES;UIView commitAnimations;
它翻转一半并迅速显示另一个视图。告诉我怎么做?
发布于 2013-06-04 06:56:09
试着分别翻转每个视图。也许就像这样
初始动画:零上下文:NULL;setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:signInView缓存:YES;UIView commitAnimations;// UIView初始动画:nil上下文:NULL;UIView set动画:0.5;UIView UIView forView:signUpView缓存:YES;signInView setHidden:YES;//您可以使用移除子视图signUpView隐藏:NO;//您可以使用addsubview UIView commitAnimations;
发布于 2013-06-04 06:41:37
首先,im将我的firstView添加到containerView中
[self.containerView addSubview:firstView];
在此之后,需要添加翻转转换。
[UIView transitionWithView:self.containerView
duration:1
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{ [firstView removeFromSuperview]; [self.containerView addSubview:secondView]; }
completion:NULL];
发布于 2013-06-04 07:03:14
你甚至可以试试这个
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 1;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 1;
animation.removedOnCompletion = NO;
animation.type = @"oglFlip";
[yourView.layer addAnimation:animation forKey:@"animation"];
如果您想要更多的动画类型:
animation.type = @"cube";
animation.type = @"suckEffect";
animation.type = @"suckEffect";
animation.type = @"pageCurl";
animation.type = @"pageUnCurl";
animation.type = @"cameraIrisHollowOpen ";
animation.type = @"cameraIrisHollowClose ";
https://stackoverflow.com/questions/16911236
复制相似问题