Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the height of UINavigationBar?

Simple question: How can I increase the height of the navigation bar so that additional widgets will fit in there while keeping the blur?

Examples are the Calendar app where weekday abbreviations are added to the bottom of the navigation bar...

Calendar app

...and in Mail when you move the mail to a different folder:

Mail app

like image 921
Mark Gaensicke Avatar asked Dec 06 '14 03:12

Mark Gaensicke


People also ask

What is navigation bar height?

Personally I feel most comfortable using a navbar height of 64px. It is enough height to accommodate a logo, and there is room enough to use text in combination with symbols.

How do I change the navigation bar height in HTML?

In order to increase the height of the navbar , you have to increase the size of the children > li > a . Keep in mind that the children already have vertical padding of 15px.


2 Answers

As iAnurag post ans is correct but still have some ui problem (Width is not proper)


You can change size by adding category like below

Sample Project
Download

Code

#import "ViewController.h"
@implementation UINavigationBar (customNav)
- (CGSize)sizeThatFits:(CGSize)size {
    CGRect rec = self.frame;
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    rec.size.width = screenRect.size.width;
    rec.size.height = 70;
    return rec.size;
}
@end

Output
enter image description here
When press on "Button" enter image description here


Problem in iAnurag Code
enter image description here
like image 54
Jageen Avatar answered Oct 17 '22 01:10

Jageen


https://developer.apple.com/library/prerelease/content/samplecode/NavBar/Introduction/Intro.html

From ReadMe.md:

Extended Navigation Bar #### This example demonstrates placing a custom view underneath the navigation bar in such a manner that view

appears to be part of the navigation bar itself. This technique may be used to create an interface similar to the iOS Calendar app.

My not humble opinion: Don't override sizeThatFits(_:), don't set constraints on nav bar height. Just do the illusion from example above.

like image 25
Stanislav Smida Avatar answered Oct 16 '22 23:10

Stanislav Smida