UIDEVICE方向

发布于 2024-09-04 01:08:13 字数 277 浏览 4 评论 0原文

大家好,我有我的启动屏幕,我想以横向模式显示它,并以纵向模式显示所有其他屏幕。我的根视图控制器充当启动屏幕,我正在 viewdidload 方法中编写此代码,

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; 

但此代码不起作用,并显示 UIdevice 可能不会响应 setorentation 请指导我如何更改仅第一个启动屏幕的方向和其他屏幕也应处于肖像模式

hello all i have my splash screen which i want to show in landscape mode and all other screen in potrait mode. My root view controller is acting as a splash screen i am writing this code in viewdidload method

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; 

But this code is not working and shows me that UIdevice may not respond to setorentation please guide me that how could i change the orentation for only first splash screen and also other screen should be in potrait mode

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

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

发布评论

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

评论(2

你丑哭了我 2024-09-11 01:08:14

UIDeviceOrientation 是指设备的物理方向,而 UIInterfaceOrientation 是指用户界面的方向。您无法更改设备的物理方向,但可以通过 [UIApplication sharedApplication].statusBarOrientation 更改状态栏的显示方式

UIDeviceOrientation refers to the physical orientation of the device whereas UIInterfaceOrientation refers to the orientation of the user interface. You can't change the physical orientation of the device, but you can change how the status bar is displayed via [UIApplication sharedApplication].statusBarOrientation

落在眉间の轻吻 2024-09-11 01:08:14

不能只让一个闪屏横向显示吗?

用户会将其解释为“横向”飞溅并进行相应调整,无论您的应用程序是否确实认为如此。只需确保在 shouldAutorotateToInterfaceOrientation: 中返回 NO,这样当用户转动它时它就不会旋转。

警告:可能值得调整您的启动屏幕,使其处于纵向方向,因为向用户建议您的应用程序喜欢横向,然后尽快切换到纵向可能会很烦人因为它实际上开始了。

不过,如果您确实愿意,可以使用 setStatusBarOrientation:animated:UIApplication 上强制方向。

Can't you just have a splash screen that is displayed sideways?

The user will interpret that as a "landscape" splash and adjust accordingly, whether or not your application actually thinks it is. Just make sure to return NO in shouldAutorotateToInterfaceOrientation: so it doesn't rotate away when the user turns it.

But a warning: it's probably worthwhile to tweak your splash screen so it is in the portrait orientation, since it may be annoying to suggest to the user that your app likes landscape, and then switch to portrait as soon as it actually starts.

If you really want to, though, you can use setStatusBarOrientation:animated: on the UIApplication to force the orientation.

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