iOS6隐藏状态栏 [英] iOS6 hidden status bar

查看:154
本文介绍了iOS6隐藏状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在XCode 5中,如果我在项目目标设置中选中状态栏在应用程序启动期间隐藏

In XCode 5 if I check Status Bar: Hide during application launch in project target settings.


  • 在iOS7中,应用程序按预期工作,启动后应用程序的状态栏可见

  • 但在iOS6中,应用程序启动后隐藏状态栏

有关如何在应用程序启动期间隐藏状态栏,在iOS6和iOS7上工作的建议吗?

Any suggestion how to make Status bar hidden during application launch, working on iOS6 and iOS7 ?

推荐答案

对于iOS6及以下版本,我们曾在 didFinishLaunchingWithOptions:中编写一行代码

For iOS6 and below, we used to write a line of code in didFinishLaunchingWithOptions: as

[UIApplication sharedApplication].statusBarHidden = YES;

但是,如果您要访问相机的照片库,则必须小心某些事件。在该屏幕中,将显示状态栏。有趣的是,在关闭包含照片库的屏幕后,状态栏会再次出现。因此,在照片库屏幕被关闭后,在第一个屏幕的视图控制器内,您必须再次编写该段代码。

However you have to be careful in some events like if you are accessing photo library of your camera. In that screen, status bar will appear. Interestingly, after the screen containing the photo library is dismissed, the status bar appears again. So inside the view controller of the first screen after the photo library screen is dismissed, you have to write that piece of code again.

对于iOS7,程序已更改。您必须在应用程序的 info.plist 中进行设置。如果您为同一个应用程序设置了多个目标,则对于每个 info.plist ,您必须设置的键,查看基于控制器的状态栏外观。只是为了轻松记住键名,按字母顺序,它是友好键值格式的最后一个键。

For iOS7, the procedure has changed. You have to set it in info.plist of your application. If you are having multiple targets for the same app, for each of the info.plist, you have to set the key of View controller-based status bar appearance as NO. Just to easily remember the key name, alphabetically, it is the last key in friendly key-value format.

使用XIB,您无法隐藏状态栏。但是出于可视化目的,当您设计屏幕时,您可以隐藏它或显示它。

Using XIB, you can't hide the status bar. However for visualization purpose, when you are designing the screen, you can hide it or show it.

希望这个答案对您有所帮助。

Hope this answer helps you.

这篇关于iOS6隐藏状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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