在 iPhone 应用程序中弹出视图控制器时的景观动画错误

发布于 2024-07-30 10:53:30 字数 328 浏览 0 评论 0原文

我最近在我的 iPhone 基于导航的应用程序中添加了横向自动旋转,但是我遇到了一个奇怪的问题,我不知道如何修复,也不知道我的代码是否是 cuplrit。 这很奇怪,因为我正在按照苹果开发人员中心的自动旋转文档实现所有内容(即响应 shouldAutorotateToBlaBla 并确保我的视图自动调整正确)。

问题是,虽然推动视图控制器可以正确动画,但弹出它们会导致动画有时移动 20px,然后向上移动屏幕,而不是相对于当前旋转从右到左。

换句话说,当您在横向视图控制器中按“后退”键时,它不会向屏幕右侧显示动画,而是垂直向下显示动画,就像处于纵向方向一样。

有什么线索吗?

I've recently added landscape autorotation to my iPhone navigation based application, however I'm having a bizarre issue which I have no idea how to fix or whether my code is even the cuplrit. Its bizarre because I'm implementing everything as per the autorotation docs on Apple's developer center (that is responding to shouldAutorotateToBlaBla and making sure my views autoadjust correctly).

The problem is that while pushing view controllers animates correctly, popping them off causing the animation to sometimes shift 20px then animate UP the screen, not from right to left relative to the current rotation.

In other words, when you hit Back in a landscape view controller, instead of animating to the right off the screen, it animates vertically down as if it was in Portrait orientation.

Any clues?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不可一世的女人 2024-08-06 10:53:30

我遇到了这个错误,但通过在我拥有的每个视图控制器中实现此 UIViewController 方法来修复它。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return interfaceOrientation == UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}

I had this bug, but fixed it by implementing this UIViewController method in every view controller I had.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return interfaceOrientation == UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文