您的位置:首页 > 移动开发 > IOS开发

Status Bar in iOS7

2014-11-05 13:47 375 查看
This is a very important change in iOS 7: the status bar is no longer a separate bar. It’s now something that simply gets drawn on top of your view controllers. In previous versions of iOS, if your app displayed the status bar the height of the view controller’s view was reduced to compensate — especially if it contained a navigation bar. In iOS 7, your view controllers are always supposed to fill the entire screen.

If your app has content near the top of the screen but no navigation bar, then you have a problem on your hands, as the status bar will draw on top of that content. That’s exactly what’s happening on the Map Detail screen. There are three possible ways to handle this:

• Move your content down by 20 points and make room for the status bar. This is the easiest solution, but it doesn’t work very well if your content is embedded in a scroll view or relies on a table view.

• Implement the prefersStatusBarHidden method in your UIViewController subclass, and return YES to hide the status bar. The problem with this approach is that a user wants to keep the status bar visible in most non-game apps.

• Add a navigation bar on top, either by embedding the view controller inside a navigation controller, or by adding your own instance of UINavigationBar. The navigation bar will extend under the status bar. Your content will still sit under these two bars, but the navigation bar will blur it. This is the approach you’ll take in this tutorial.

--------iOS_7_by_Tutorials_1_1/Chapter 7: Transitioning to iOS 7 – What’s New with Auto Layout Page.244
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: