没有 ViewController 的横向模式

发布于 2024-12-06 15:09:59 字数 287 浏览 0 评论 0原文

我有一个基于窗口模板的项目,所以它没有 viewController。现在,我试图仅在横向模式下进行此操作,并且我已将“支持的设备方向”设置为仅“横向(右侧主页按钮)”,这正是我想要的方式。该应用程序实际上是在横向模式下启动的,但是当我想显示一张横向全屏图像时,iOS 会以纵向模式绘制它,并剪掉不适合的部分。好吧,我知道实现 ViewController 并编辑“shouldAutorotate...”方法的选项,但我想不这样做。 我心中有一个解决方案,但我不确定它是否是一个好主意:使用“CGTransform ...”手动旋转应用程序启动时的整个坐标系

I have a project based on a window-template, so it doesn't have a viewController. Now I'm trying to make this work in landscape only, and I have set the "supported device orientations" to "Landscape (right home button)" only, just the way I want it. The app actually launches in Landscape mode, but when I want to show an image which is btw a landscape-fullscreen one, iOS draws it in Portrait mode, cutting off what doesn't fit. Well I know the option of implementing a ViewController and editing the "shouldAutorotate..." method, but I want to do it without.
I have one solution in my mind, but I'm not sure whether it#s such a great idea: Rotate the whole coordinate-system on app-startup manually using "CGTransform..."

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

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

发布评论

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

评论(1

感性不性感 2024-12-13 15:09:59

沿着这条路走下去就是疯狂。仅仅因为模板不包含内置 UIViewController 并不意味着您不能自行添加。

添加一个,就可以避免无数的头痛。

从更技术的角度来看,很多 UIKit 期望窗口有一个 UIViewController,没有 UIViewController 意味着你可能会失去很多你想要的行为否则免费获得。

Down that path lies madness. Just because the template doesn't include a built-in UIViewController doesn't mean you can't add one yourself.

Add one, and save yourself a bazillion headaches.

From a more technical standpoint, a lot a UIKit expects the window to have a UIViewController, and not having one means you can lose out on a whole lot of behavior that you would otherwise get for free.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文