我发生了一件奇怪的事情。我有我的视图然后我有一个滚动视图,我用一个按钮动画。一切正常,但原生对话框开始捡到怪异的动画? (参见GIF示例)当我注释掉我的代码并运行时 - 这不再发生了。以下是问题代码。知道我需要改变什么以使其不影响iOS UIAlerts?任何帮助将不胜感激!
- (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];
}
}
答案 0 :(得分:1)
系统对话框正在尝试显示在其父视图的中心,但您正在更改父视图的边界。在允许UIActionSheet出现之前,请确保您的视图已完成动画。