简体   繁体   English

显示iOS 8横向的状态栏

[英]Display status bar on landscape orientation for iOS 8

Currently using XCode6 at the moment. 目前正在使用XCode6。 Since this version of XCode only supports iPhone4 and above with OS version (7.0.3 onwards). 由于此版本的XCode仅支持iPhone4及更高版本的OS版本(7.0.3以上版本)。

I have this application solely designed with a landscape orientation to all of the views in the storyboard. 我将此应用程序单独设计为横向显示故事板中的所有视图。 Testing the application using version 7.0.3 was fine, the status bar was still visible. 使用版本7.0.3测试应用程序很好,状态栏仍然可见。 It wasn't the same for version 8.0 wherein the status bar was hidden. 对于隐藏状态栏的8.0版本,情况并不相同。

My question is how is it possible to display the status bar on my landscape oriented application that supports version 7.0.3 onwards. 我的问题是如何在支持7.0.3版本的面向横向的应用程序上显示状态栏。 Thanks. 谢谢。

To display status bar in landscape mode in ios 8, try following method 要在ios 8中以横向模式显示状态栏,请尝试以下方法

- (BOOL)prefersStatusBarHidden {
    return NO;
}

Also what you can try is when the app goes landscape mode, write below line. 此外,您可以尝试的是当应用程序进入横向模式时,写入下面的行。

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
  1. Make changes to the supported orientation in xcode so that it supports only landscape mode. 在xcode中更改支持的方向,使其仅支持横向模式。
  2. Go to info.plist and add an entry and set "View controller-based status bar appearance" = NO 转到info.plist并添加一个条目并设置“查看基于控制器的状态栏外观”= NO
  3. Go to your AppDelegate.m and add [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; 转到你的AppDelegate.m并添加[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

I'm not sure if this is the right answer. 我不确定这是不是正确的答案。 Yet this one works but there's a glitch on iPhone6/iPhone6Plus, it doesn't get displayed upon application start. 然而这个可以工作,但iPhone6 / iPhone6Plus上有一个小故障,它在应用程序启动时不会显示。

[application setStatusBarHidden: NO];

From what I can tell, unless Apple have introduced a new API that I haven't found... The status bar is always hidden when the devices vertical size class is compact. 据我所知,除非Apple推出了一个我没有找到的新API ...当设备垂直尺寸类紧凑时,状态栏总是隐藏的。

I haven't found a way around this yet but I don't think there is a way to get around it.. All of the system apps do the exact same thing. 我还没有找到解决方法,但我认为没有办法绕过它..所有的系统应用都做同样的事情。

Although, if you compile your app against the iOS 7.1 SDK you can still keep the status bar in landscape but thats not very useful if you want to adopt the new APIs etc. 虽然,如果您针对iOS 7.1 SDK编译您的应用程序,您仍然可以保持状态栏的状态,但如果您想采用新的API等,这不是很有用。

Edit: 编辑:

Maybe i'm wrong, the native Twitter app keeps the status bar when viewing a web page in landscape... Not sure how its being done though... 也许我错了,本地Twitter应用程序在横向查看网页时保持状态栏...不确定它是如何完成的...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM