Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the height of navigation bar in Xcode?

I'm working on a app, in which I need to keep a navigation bar. when I write any title on the bar, the time and the title kinda get very close to each other. I wanted to increase the height of the bar, so it can get some breathing room.

like image 579
Mayur Tolani Avatar asked Aug 11 '15 11:08

Mayur Tolani


People also ask

What is the height of navigation bar iPhone?

On iPhone tab bars remain 49 points tall in portrait and 32 points tall in landscape. iPhone X added extra height for the Home Bar to toolbars and tab bars and their sizes are unchanged from iOS 11: 83 points tall in portrait and 53 points tall in landscape.

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.


1 Answers

select your ViewController --> select your Navigation Item --> Prompt --> Add space it increase the height of **Navigation bar**

Check Image here : enter image description here

Programatically

Add this in viewWillAppear or viewDidAppear method

Objective-C

[self.navigationController.navigationBar setFrame:CGRectMake(0, 0, self.view.frame.size.width,80.0)]; 

Swift

self.navigationController.navigationBar.frame = CGRectMake(0, 0, self.view.frame.size.width, 80.0) 

Swift-3

self.navigationController!.navigationBar.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 80.0) 

iOS 11

enter image description here

objective C

for (UIView *subview in self.navigationController.navigationBar.subviews) {     if ([NSStringFromClass([subview class]) containsString:@"BarBackground"]) {         CGRect subViewFrame = subview.frame;         // subViewFrame.origin.y = -20;         subViewFrame.size.height = 100;         [subview setFrame: subViewFrame];     } } 

swift

for subview in (self.navigationController?.navigationBar.subviews)! {        if NSStringFromClass(subview.classForCoder).contains("BarBackground") {             var subViewFrame: CGRect = subview.frame             // subViewFrame.origin.y = -20;             subViewFrame.size.height = 100             subview.frame = subViewFrame          }      } 
like image 137
Anbu.Karthik Avatar answered Sep 20 '22 08:09

Anbu.Karthik