gpt4 book ai didi

ios - UIAlert 对话框的动画非常奇怪?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:20:50 26 4
gpt4 key购买 nike

我遇到了一件奇怪的事情。我有我的 View ,然后我有一个 ScrollView ,我用一个按钮在其中设置动画。一切正常,但 native 对话框开始出现奇怪的动画? (参见 GIF 示例)当我注释掉我的代码并运行时 - 这不再发生。下面是问题代码。知道我需要更改什么以使其不影响 iOS UIAlerts 吗?任何帮助将不胜感激!

enter image description here

- (IBAction)openMenu:(id)sender {


if (draw1 == 0) {

draw1 = 1;

[openMenu setTitle:@"Close" forState:UIControlStateNormal];

[UIScrollView beginAnimations:nil context:nil];
[UIScrollView setAnimationDuration:0.5];
[UIScrollView setAnimationDelay:0.0];
[UIScrollView setAnimationCurve:UIViewAnimationCurveEaseOut];

[UIButton beginAnimations:nil context:nil];
[UIButton setAnimationDuration:0.5];
[UIButton setAnimationDelay:0.0];
[UIButton setAnimationCurve:UIViewAnimationCurveEaseOut];

scrollView.frame = CGRectMake(0, 0, 768, 100);
openMenu.frame = CGRectMake(690, 195, 60, 60);

[self.view bringSubviewToFront:scrollView];

[UIScrollView commitAnimations];

} else {


draw1 = 0;

[openMenu setTitle:@"Open" forState:UIControlStateNormal];
[UIScrollView beginAnimations:nil context:nil];
[UIScrollView setAnimationDuration:0.5];
[UIScrollView setAnimationDelay:0.0];
[UIScrollView setAnimationCurve:UIViewAnimationCurveEaseOut];

[UIButton beginAnimations:nil context:nil];
[UIButton setAnimationDuration:0.5];
[UIButton setAnimationDelay:0.0];
[UIButton setAnimationCurve:UIViewAnimationCurveEaseOut];

scrollView.frame = CGRectMake(0, -100, 768, 100);
openMenu.frame = CGRectMake(690, 95, 60, 60);

[UIScrollView commitAnimations];

}
}

最佳答案

系统对话框试图显示在其父 View 的中心,但您正在更改父 View 的边界。在允许 UIActionSheet 出现之前,请确保您的 View 已完成动画。

关于ios - UIAlert 对话框的动画非常奇怪?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18404339/

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