没有 ViewController 的横向模式
我有一个基于窗口模板的项目,所以它没有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
沿着这条路走下去就是疯狂。仅仅因为模板不包含内置
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.