3

我发生了一件奇怪的事情。我有我的视图,然后我有一个滚动视图,我用一个按钮在其中设置动画。一切正常,但原生对话框开始出现奇怪的动画?(参见 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];

    }
}
4

1 回答 1

1

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

于 2013-08-23T13:44:21.440 回答