gpt4 book ai didi

ios - UIView 组合不同时长的动画

转载 作者:行者123 更新时间:2023-11-29 02:29:54 25 4
gpt4 key购买 nike

我想在我的 View 中设置 alpha 变化和帧变化的动画。要注意的是我希望 alpha 更改在帧更改之前结束。目前我正在做这样的事情来同时实现这两个目标:

UIView *someview = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
[self.view addSubview:someview];
someview.alpha = 0.0f;
[UIView animateWithDuration:1 animations:^{
self.view.alpha = 1.0f;
self.view.frame = CGRectMake(200, 200, 100, 100);
}];

最佳答案

我认为你应该替换这个:

[UIView animateWithDuration:1 animations:^{
self.view.alpha = 1.0f;
self.view.frame = CGRectMake(200, 200, 100, 100);
}];

到:

[UIView animateWithDuration:1 animations:^{
self.view.alpha = 1.0f;
}];
[UIView animateWithDuration:1.4 animations:^{
self.view.frame = CGRectMake(200, 200, 100, 100);
}];

关于ios - UIView 组合不同时长的动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27036113/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com