gpt4 book ai didi

xamarin.ios - 在不同 View 上旋转 iPad 屏幕方向

转载 作者:行者123 更新时间:2023-12-02 02:13:48 24 4
gpt4 key购买 nike

我有一个以纵向模式打开的 iPad 应用程序,但是当我切换到另一个 View 时,我需要将方向强制为横向,以便用户意识到他们需要物理地将屏幕方向移动到横向,然后当他们离开时这个 View 我需要强制方向回到纵向。

我可以看到 ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation),如果正确相信它只会限制 View 可能的方向,但将其设置为一个方向(例如 UIInterfaceOrientation.LandscapeRight)不会强制改变方向。

我看到了一些关于使用 this.View.Transform.Rotate(...) 强制 View 旋转的其他建议,但似乎对我不起作用。

只是想知道是否有人有任何建议或能够为我指明正确的方向?

谢谢

最佳答案

您的 View 是否都显示在单个 uinavigationcontroller 中?

如果是,那么恐怕答案是您无法实现您想要的 - 查看完整的解释,包括指向 Apple 开发人员文档的链接:How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?

如果您确实想要实现您正在寻找的效果,那么也许可以切换到对所有 subview 使用其他“父” - 例如模态显示它们?

关于xamarin.ios - 在不同 View 上旋转 iPad 屏幕方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11541211/

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