UISplitViewController和方向-iOS& lt;5.0 [英] UISplitViewController and orientation - iOS < 5.0

查看:61
本文介绍了UISplitViewController和方向-iOS& lt;5.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用splitviewcontroller作为我的应用程序的rootview.我需要在splitviewcontroller顶部以模式视图显示登录和注册视图.当我尝试从splitViewController的rootview的viewdidAppear方法呈现登录/注册视图时,它没有显示出来.我尝试使用以下代码从Appdelegate的didFinishLaunching方法中显示登录/注册视图

I am using a splitviewcontroller as the rootview of my application. I need to show the login and registration views as a modal view on top of the splitviewcontroller. When i try presenting login/reg view from the viewdidAppear method of splitViewController's rootview, it is not showing up. I tried presenting the login/reg view from the Appdelegate's didFinishLaunching method using the following code

[self.window.rootViewController presentModalViewController:self.navController animated:NO]; 

它有效.

我的问题是,该应用程序支持两种横向方向,但是当我在设备中运行它时,无论我以哪种方向握住设备,我都只会得到LandscapeRight作为方向.因此,如果我以LandscapeLeft方向握住设备,则应用程序启动时将登录屏幕上下颠倒.我正在使用LandscapeLeft&就在info.plist上受支持的方向上.

My problem is, the application supports both the landscape orientations, but when i run it in the device, no matter in which orientation i hold the device, I get only LandscapeRight as orientation. So if i hold the device in LandscapeLeft orientation, app lauches with login screen upside down. I am using LandscapeLeft & Right in supported orientations on the info.plist.

请帮助我解决问题.还有,当我们将splitViewcontroller作为应用程序的rootview时,我们将如何呈现视图?

Please help me resolve the issue. Also how will we present a view when we have splitViewcontroller as the rootview of the app?

在iOS 5.0中(仅),我能够通过splitviewcontroller的rootview控制器-viewdidAppear方法显示登录视图.在所有其他OS版本中,此情况均无法正常运行,我需要通过Appdelegate的didFinishLaunching方法来展示它.

In iOS 5.0 (only) I am able to present the login view from the splitviewcontroller's rootview controller - viewdidAppear method. In all other OS versions, this case is not working and i need to present it from the Appdelegate's didFinishLaunching method.

推荐答案

如果我没记错的话,iOS会在第一次旋转之前误报实际的方向 .

If I remember correctly, iOS misreports the actual orientation until the first rotation.

IIRC还使用 [[UIApplication sharedApplication] statusBarOrientation] 来解决此问题.

Also IIRC, using [[UIApplication sharedApplication] statusBarOrientation] circumvents this problem.

这篇关于UISplitViewController和方向-iOS& lt;5.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆