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

查看:12
本文介绍了状态栏出现在 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 版本,请指定一组约束,自动布局可使用这些约束来调整故事板或 XIB 文件中的视图和控件(要了解有关约束的更多信息,请参阅约束表达视图之间的关系").

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 中使用自动布局时,它显示一个错误,即自动布局在 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. 确保 Hide during application launch 仍处于选中状态,以支持以前的操作系统版本.
  2. 在您的 Info.plist 文件中,添加 基于控制器的状态栏外观 并将其设置为 NO.
  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天全站免登陆