UISplitViewController和方向 - iOS< 5 [英] UISplitViewController and orientation - iOS < 5.0

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

问题描述

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

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作为应用程序的根视图时,我们将如何呈现视图?

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方法。在所有其他操作系统版本中,这种情况不起作用,我需要从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< 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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