状态栏显示在iOS 7中的视图边界上 [英] Status bar appear over my view's bounds in iOS 7

查看:110
本文介绍了状态栏显示在iOS 7中的视图边界上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在iOS 7中测试我的应用程序,然后我发现我的视图显示在状态栏上...正如我所读,在iOS 7中,状态栏被隐藏。那么如何让它兼容在iOS 6和iOS 7中运行?我是否必须为每个屏幕为不同的iOS版本制作不同的.xib文件?

I tried to test my app in iOS 7, and then I find my view appears over the status bar... As I read, in iOS 7, the status bar is hidden. So how do I make it compatible to run both in iOS 6 and iOS 7? Should I have to make different .xib files for different iOS versions for each screen?

我一直在读这个:
如果两个版本的标准应该具有类似的布局,使用自动布局来创建在两个版本的iOS中都能正常工作的UI。要支持多个版本的iOS,请指定一组约束,Auto Layout可以使用这些约束来调整storyboard或XIB文件中的视图和控件(要了解有关约束的更多信息,请参阅约束Express视图之间的关系)。

I have been going through reading this: If both versions of a standard app should have a similar layout, use Auto Layout to create a UI that works correctly in both versions of iOS. To support multiple versions of iOS, specify a single set of constraints that Auto Layout can use to adjust the views and controls in the storyboard or XIB files (to learn more about constraints, see "Constraints Express Relationships Between Views").

如果标准应用的两个版本都应具有相似的布局,并且您没有使用自动布局,请使用偏移。要使用偏移,请首先更新iOS 7的UI。接下来,指定将早期UI中每个元素的原点,高度和宽度定义为iOS 7 UI中元素新位置偏移的值。

If both versions of a standard app should have a similar layout, and you’re not using Auto Layout, use offsets. To use offsets, first update the UI for iOS 7. Next, specify values that define the origin, height, and width of each element in the earlier UI as offsets from the element’s new position in the iOS 7 UI.

但是当我在.xib中使用autolayout时,它会显示autolayout在iOS 6的先前版本中的错误。

But when I use autolayout in .xib, it shows an error that autolayout is in a prior version to iOS 6.

如何我是否解决了这个问题?

How do I fix this problem?

推荐答案

iOS 7显然支持某些视图隐藏的状态栏,但不支持其他视图。要为所有视图隐藏它,请执行以下操作:

iOS 7 apparently supports the Status Bar being hidden for some views but not others. To hide it for all views, do the following:


  1. 确保在应用程序启动期间隐藏,以支持以前的操作系统版本。

  2. 在Info.plist文件中,添加查看基于控制器的状态栏外观并将其设置为

  3. 您可能需要在构建之前清理,(我这样做),但是您的应用程序应该像以前一样工作:没有状态栏悬挂在您的视图上!

  1. Make sure Hide during application launch is still checked, to support previous OS versions.
  2. In your Info.plist file, add View controller-based status bar appearance and set it to NO.
  3. You may need to "Clean" before building, (I did), but then your app should work as before: no status bar hanging over your views!

这篇关于状态栏显示在iOS 7中的视图边界上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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