如何解决如何翻转两个视图Objective C iOS 13
我有两个翻转的视图(例如在卡上水平翻转)。 iOS 13已贬值了开始动画代码,我正在尝试找出如何使用[UIView animateWithDuration:delay:options:animations:completion:]
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.ABCard cache:YES];
[self.ABCard exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
我正在尝试执行以下操作,但是动画只是在没有翻转动作的情况下立即切换视图。
[UIView animateWithDuration:1.0 delay:1.0
options: UIViewAnimationCurveEaseInOut | UIViewAnimationTransitionFlipFromLeft
animations:^{
[self.ABCard exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
} completion:^(BOOL finished){
}];
解决方法
exchangeSubviewAtIndex不会更改动画的外观,因此不会产生动画,这就是为什么只看到它翻转的原因。
此答案的结果可能会帮助您找到适当的解决方案:iPhone Flip Animation using UIViewAnimationTransitionFlipFromLeft in landscape mode
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。