ViewB
and ViewC
are subviews of ViewA
. Say ViewB
is currently on top of ViewC
. I would like to bring ViewC
on top with flipping animation as shown in the diagram. I use the UIView
class method (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion
. However, the ViewA
gets flipped along with viewB
which is not the desired behavior. The desired behavior is only for ViewB
to flip over and ViewC
is now on top. Any idea how to achieve the desired behavior?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try this :
-(void)FilpAnimation
{
viewObjB.alpha=1.0;
viewObjB.hidden=NO;
[UIView transitionWithView:viewObjB
duration:1.5
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
viewObjB.hidden=YES;
viewObjB.alpha=0.0;
} completion:nil];
viewObjC.alpha=0.0;
viewObjC.hidden=YES;
[UIView transitionWithView:viewObjC
duration:1.5
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
viewObjC.hidden=NO;
viewObjC.alpha=1.0;
} completion:nil];
}