我正在尝试在容器中的视图之间翻转或卷曲,使用以下代码可以很好地工作:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.8];
[UIView setAnimationTransition:animationOption
forView:container cache:YES];
[container addSubview:nuView];
[oldView removeFromSuperview];
[UIView commitAnimations];
但没有
[UIView transitionWithView:container
duration:.8
options:animationOption
animations:^
{
[container addSubview:nuView];
[oldView removeFromSuperview];
}
completion:^(BOOL finished)
{
}];
有什么想法吗?
答案 0 :(得分:1)
什么是animationOption
?此代码在我的某个应用中非常有效:
[UIView transitionWithView:currentContainerView
duration:0.75
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[currentContainerView.frontView removeFromSuperview];
[currentContainerView addSubview:currentContainerView.flippedSideView];
}
completion:^(BOOL finished) {
// stuff
}];
答案 1 :(得分:1)
检查您是否正在使用UIViewAnimationOptionTransition或UIViewAnimationTransition!