简体   繁体   中英

How can I prevent view content from going under the status bar in iOS7?

I have an app compiled for iOS7 and 6, but is very difficult manage the different behavior of the status bar. There is a way to prevent the content going under the status bar ?

Thanks.

In iOS7, the status bar always overlaps your view controller's view. It's up to you how you want to position subviews such that they do not go under the status bar.

If you are not using auto layout, you can use the iOS 6/7 deltas on the size inspector in interface builder to adjust the position of elements in iOS 6/7 as appropriate (usually by setting the y delta to -20 on iOS 7).

iOS 6/7增量

If you are using auto layout, you can create a vertical constraint between your views and the top layout guide to ensure that they are positioned correctly. Just control-drag from the top layout guide to your top-most view.

控制 - 从顶部布局指南拖动到视图

选择垂直间距

Have a look here:

http://www.doubleencore.com/2013/09/developers-guide-to-the-ios-7-status-bar/

at Supporting Older Versions of iOS Alongside iOS 7 section and use Deltas parameters.

It might help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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