CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.7 ; // 动画持续时间(秒)
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.type = kCATransitionFade;//淡入淡出效果
NSUInteger f = [[rView subviews] indexOfObject:fView];
NSUInteger z = [[rView subviews] indexOfObject:zView];
[rView exchangeSubviewAtIndex:z withSubviewAtIndex:f];
[[rView layer] addAnimation:animation forKey:@"animation"];iOS view淡入淡出切换
最新推荐文章于 2021-03-15 15:15:38 发布
本文介绍如何使用Core Animation创建UIView的淡入淡出动画效果。通过设置CATransition属性,如持续时间、缓动曲线及类型等,实现视图间平滑过渡。并展示了如何调整视图层级以确保动画正确播放。
1012

被折叠的 条评论
为什么被折叠?



