Change UINavigationBar Height Change UINavigationBar Height ios ios

Change UINavigationBar Height


You can create a category class based on UINavigationBar like this

.h file

#import UIKit/UIKit.h    @interface UINavigationBar (myNave)- (CGSize)changeHeight:(CGSize)size;@end

and .m file

#import "UINavigationBar+customNav.h"@implementation UINavigationBar (customNav)- (CGSize)sizeThatFits:(CGSize)size {    CGSize newSize = CGSizeMake(320,100);    return newSize;}@end

It works very nice.


You should not change the height of the navigation bar.From Apple Programing Guide on View Controller:

Customizing the Navigation Bar Appearance

In a navigation interface, a navigation controller owns its UINavigationBar object and is responsible for managing it. It is not permissible to change the navigation bar object or modify its bounds, frame, or alpha values directly. However, there are a few properties that it is permissible to modify, including the following:

● barStyle property

● translucent property

● tintColor property

(taken from Apple: https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/NavigationControllers.html)

-- UPDATE -- IOS 7 --- still only the available properties can be changed but below is a great tutorial on how to achieve flexibility in the navigation bar http://www.appcoda.com/customize-navigation-status-bar-ios-7/


I have solved this issue, I created the subclass of UINavigationController. In this MainNavigationViewController.m file I rewrite viewDidLayoutSubviews() method, where I set the frame for self.navigationBar