开发者

Landscape mode without a ViewController

开发者 https://www.devze.com 2023-04-07 19:26 出处:网络
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 \"Landsc

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 Vi开发者_开发问答ewController 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..."


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号