iOS 7中导航栏的高度是多少? [英] What is the height of Navigation Bar in iOS 7?

查看:408
本文介绍了iOS 7中导航栏的高度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用默认的Master Details模板创建了一个简单的iOS 7应用。

I 've just created a simple iOS 7 app using the default Master Details template.

MasterViewController.m viewDidAppear 方法,我记录了

self.navigationController.navigationBar.frame.size.height
self.navigationController.navigationBar.frame.origin.y



<并且相应地收到了44和20。这看起来很奇怪,因为根据我的阅读,iOS 7中的导航栏应该是64点高度并从0点开始,因此它位于状态栏下方。我读的是

and received 44 and 20 accordingly. This seems weird, because from what I read, the Navigation Bar in iOS 7 should be 64 point height and start at 0 point, so that it sits underneath the Status bar. What I read are

1) iOS 7用户界面转换指南


因为状态栏是透明的,所以后面的视图显示

Because the status bar is transparent, the view behind it shows through

2)在导航栏中使用背景图像


如果你的应用程序使用自定义图像作为条形图的背景,你需要提供一个更高的图像,以便它向上延伸到
状态栏后面。导航栏的高度从44点(88
像素)更改为64点(128像素)。

If your app uses a custom image as the background of the bar, you’ll need to provide a "taller" image so that it extends up behind the status bar. The height of navigation bar is changed from 44 points (88 pixels) to 64 points (128 pixels).


推荐答案

我从编程iOS 7一书中得到了这个答案,条形图栏位和条形码指标

I got this answer from the book Programming iOS 7, section Bar Position and Bar Metrics


如果a导航栏或工具栏 - 或搜索栏(前面在
本章中讨论过) - 是占据屏幕的顶部,iOS 7
惯例是它的高度应增加到低于
透明状态栏。为了实现这一目标,iOS 7引入了一个条形位置的
概念。

If a navigation bar or toolbar — or a search bar (discussed earlier in this chapter) — is to occupy the top of the screen, the iOS 7 convention is that its height should be increased to underlap the transparent status bar. To make this possible, iOS 7 introduces the notion of a bar position.

UIBarPositionTopAttached

UIBarPositionTopAttached


指定栏位于屏幕顶部,以及包含
的视图。具有此位置的条形图将其背景向上扩展
,允许其背景内容通过状态栏显示
。适用于iOS 7.0及更高版本。

Specifies that the bar is at the top of the screen, as well as its containing view. Bars with this position draw their background extended upwards, allowing their background content to show through the status bar. Available in iOS 7.0 and later.

这篇关于iOS 7中导航栏的高度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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