gpt4 book ai didi

ios - 检查 UIView 当前是否正在动画

转载 作者:可可西里 更新时间:2023-11-01 05:57:42 26 4
gpt4 key购买 nike

我有两个动画正在运行;显示搜索栏并显示横幅。这两个动画都在调整同一个 View 的大小,如果它们同时运行(它们是),最新的动画将取消调整大小。无论如何检查 UIView 当前是否正在动画然后等待动画?

我很确定我没有使用 CAAnimations,因为 Cocoa 没有检测到此类。

收到广告时,此广告正在运行。不幸的是,这与 ShowSearch 运行的时间相同。

- (void)adViewDidReceiveAd:(GADBannerView *)bannerView {
if (!hasloaded) {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration: 1.0];

[bannerView_ setFrame:CGRectMake(0, self.view.frame.size.height, bannerView_.frame.size.width, bannerView_.frame.size.height)];

// move and grow
[bannerView_ setFrame:CGRectMake(0, self.view.frame.size.height-50, bannerView_.frame.size.width, bannerView_.frame.size.height)];
// set original position
[UIT setFrame:CGRectMake(UIT.frame.origin.x, UIT.frame.origin.y, UIT.frame.size.width, UIT.frame.size.height)];

// move and grow
[UIT setFrame:CGRectMake(UIT.frame.origin.x, UIT.frame.origin.y, UIT.frame.size.width, UIT.frame.size.height-50)];

[UIView commitAnimations];
hasloaded = true;
}
}

最佳答案

您可以在UIView 方法中使用完成 block +animateWithDuration:animations:completion: (这是 beginAnimations/commitAnimations 的更现代的替代方法)链接多个动画(我猜这就是你想要做的?)。

关于ios - 检查 UIView 当前是否正在动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9655157/

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