支持多种界面方向,但保持锁定在纵向模式(Support several interface orientations but stay locked in portrait mode)

编程入门 行业动态 更新时间:2024-10-27 18:17:39
支持多种界面方向,但保持锁定在纵向模式(Support several interface orientations but stay locked in portrait mode)

我需要一种方法来做到这一点。 我试过试试

-(BOOL) shouldAutorotate { return NO; }

进入我的每个视图控制器,但是当我将设备倾斜到侧面时它仍然会自动旋转。

我为什么需要这个? 我们的合作伙伴之一有一个SDK,它要求我们支持其他方向(或者他们的应用程序崩溃)。

那么我该怎样做才能锁定我们的肖像模式并保持原样呢?

I need a way to do the above. I've tried putting

-(BOOL) shouldAutorotate { return NO; }

into every one of my viewcontrollers, but it still autorotates when I tilt the device on its side.

Why do I need this? One of our partners has an SDK which requires us to support the other orientations (or else their app crashes).

So what can I do to lock our portrait mode in place and keep it like that?

最满意答案

不可能。 在iOS“支持”中,设备方向意味着当屏幕旋转到其他方向之一(而不是纵向)时,您的应用程序会重新调整大小并为该方向进行布局。 如果您想在纵向模式下保持锁定,请勿支持除肖像以外的任何其他内容。

I used a category to extend and override the UITabBarController, forcing autorotation off.

Check out this SO: UITabBarController Rotation Issues in ios 6

更多推荐

本文发布于:2023-07-05 02:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1032108.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:纵向   界面   多种   方向   模式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!