我使用以下代码为页面设置动画。
[UIView a animateWithDuration:0.3
animations:^{
text.alpha=0;
} completion:^(BOOL finished) {
//some code
}];
现在我想用一些动画风格(卷曲波纹等)来改变视图。我该怎么做?
答案 0 :(得分:7)
[UIView transitionWithView:superView duration:1.0
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
[self.view removeFromSuperview];
[superView addSubview:newView];
}
completion:NULL];
答案 1 :(得分:1)
您可能需要设置动画过渡:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:NO];
//your code
[UIView commitAnimations];
答案 2 :(得分:0)
//直接尝试uiview或将uiview更改为ui viewcontroller中的视图
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self cache:YES];
[UIView commitAnimations];
答案 3 :(得分:0)
我认为它可以替代superview:
[UIView transitionWithView:self.parentViewController.view duration:1.0
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
[self.view removeFromSuperview];
[self.parentViewController.view addSubview:self.newVC.view];
}
completion:NULL];