iPad - CGAffineTransformMakeRotation - 保持旋转

发布于 2024-10-21 15:19:45 字数 1026 浏览 6 评论 0原文

我有一个平视显示器(HUD),我试图让它随着视图正确旋转。我创建了一个函数orientationWillChange,它应该旋转视图并且工作正常,只需要在实现它的视图控制器方面进行更多编程。

我的主要问题是它关闭时会旋转。当它关闭时,它会进行一些其他转换(缩小/褪色,使其消失),但它似乎将其旋转回“正常”。

我不想将视图再旋转 90 度,我只想确保它保持当前的旋转状态。我该怎么做?

我的关闭函数如下:(

- (void)close {
    _windowIsShowing = NO;
    [UIView animateWithDuration:0.125 animations:^{
        hudView.transform = CGAffineTransformMakeRotation(rotationDegrees * M_PI / 180);
        hudView.transform = CGAffineTransformMakeScale(1.1, 1.1);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.15 animations:^{
            hudView.transform = CGAffineTransformMakeScale(0.4, 0.4);
            hudView.alpha = 0.0;
            backgroundColorView.alpha = 0.0;
        } completion:^(BOOL finished) {
            [hudWindow resignKeyWindow];
            [self release];
        }];
    }];
}

仅供参考,这是基于 CloudApp 的 HUD )

I have a heads up display (HUD) that I'm trying to get to properly rotate with the view. I created a function orientationWillChange that is supposed to rotate the view and that works fine, just requires a little more programming on the side of the view controller implementing it.

My main problem is that it rotates when it closes. It does some other transformations when it closes (shrinking/fading it so it disappears), but it seems to be rotating it back to "normal".

I don't want to rotate the view another 90 degrees, I just want to make sure it stays in the rotation it is at. How do I do that?

My closing function is as follows:

- (void)close {
    _windowIsShowing = NO;
    [UIView animateWithDuration:0.125 animations:^{
        hudView.transform = CGAffineTransformMakeRotation(rotationDegrees * M_PI / 180);
        hudView.transform = CGAffineTransformMakeScale(1.1, 1.1);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.15 animations:^{
            hudView.transform = CGAffineTransformMakeScale(0.4, 0.4);
            hudView.alpha = 0.0;
            backgroundColorView.alpha = 0.0;
        } completion:^(BOOL finished) {
            [hudWindow resignKeyWindow];
            [self release];
        }];
    }];
}

(fyi this is based on CloudApp's HUD)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文