ios - UIView 隐藏动画在 iOS 12 中不起作用
问题描述
这是代码
- (void)viewDidLoad {
[super viewDidLoad];
UIView *testView1 = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
UIView *testView2 = [[UIView alloc] initWithFrame:CGRectMake(100, 200, 100, 100)];
testView1.backgroundColor = [UIColor blueColor];
[self.view addSubview:testView1];
[self setView:testView1 hidden:YES];
testView2.backgroundColor = [UIColor redColor];
[self.view addSubview:testView2];
[self setView:testView2 alpha:0.f];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)setView:(UIView *)view hidden:(BOOL)hidden {
[UIView transitionWithView:view duration:1.f options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
view.hidden = hidden;
} completion:^(BOOL finished) {
[self setView:view hidden:!hidden];
}];
}
- (void)setView:(UIView *)view alpha:(CGFloat)alpha {
[UIView transitionWithView:view duration:1.f options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
view.alpha = alpha;
} completion:^(BOOL finished) {
[self setView:view alpha:1.f - alpha];
}];
}
在 device:ios 11 和 ios 12 运行代码 出现的动画是同步的,但是在 iOS12 中消失的动画是瞬时的
解决方案
推荐阅读
- r - 提取两个字符之间的字符 R
- python-3.x - pyaudio 回调只调用一次
- java - 如何将对象从一个 JpaRepository 转换为另一个 JpaRepository
- java - 在 arrayList 中搜索特定输入以生成更小的 arrayList
- python - Facebook API 返回对象 ID 的列表
- java - 我正在为我的应用程序构建 googlemap 跟踪,现在我被困了五天多,我想,,简单的问题
- angularjs - 角度控制器未触发
- javascript - JavaScript:类而不是 ID
- sql - 需要从 oracle 表数据创建 Totals 报告
- office365 - office365如何删除word文档