What is the height of the navigation bar in iOS 7?

I created a simple iOS 7 application using the default master data template.

In the method MasterViewController.m , viewDidAppear I recorded for

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

and got 44 and 20, respectively. This seems strange, because from what I read, the navigation bar in iOS 7 should be 64-point in height and start at 0 point so that it is under the status bar. What i read

1) iOS 7 UI Upgrade Guide

Since the status bar is transparent, a view behind it shows through

2) Using the background image in the navigation bar

If your application uses a custom image as the background of the panel, youll need to provide a "higher" image so that it expands beyond the status bar. The height of the navigation bar changes from 44 points (88 pixels) to 64 points (128 pixels).

+64
height ios7 statusbar frame navigationbar
Nov 23 '13 at 9:58
source share
3 answers

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

If the navigation bar or toolbar - or the search bar (discussed earlier in this chapter) - occupy the top of the screen, iOS 7 should increase its height to make the status bar transparent. To make this possible, iOS 7 introduces the concept of a position in a bar.

UIBarPositionTopAttached

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

+7
May 09 '14 at 16:30
source share

There is a difference between the navigation bar and the status bar. The intricate part is that it looks like one continuous function at the top of the screen, but the areas can actually be divided into two different types; status bar and navigation bar. The status bar spans from y = 0 to y = 20 points, and the navigation bar spans from y = 20 to y = 64 points. Thus, the navigation bar (which contains the page title and navigation buttons) has a height of 44 points, but the status bar and the navigation bar together have a total height of 64 points.

Here is a great resource that solves this issue, as well as a number of other distinctive features of iOS7: http://ivomynttinen.com/blog/the-ios-7-design-cheat-sheet/

+81
Apr 6 '14 at 19:52
source share

The height of the condition may vary. Usually it is 20 pixels. However, on the iPhone, when there is a phone call, then it is 40 pixels.

 extension UIViewController { /// Returns 64 when normal /// /// Only on iPhone: Returns 84 when In-Call status bar is visible var topBarHeight: CGFloat { let statusBarHeight = UIApplication.shared.statusBarFrame.height let navigationBarHeight = self.navigationController?.navigationBar.frame.height ?? 0 return statusBarHeight + navigationBarHeight } } 
-one
Aug 22 '17 at 10:48 on
source share



All Articles