o242
o242

Reputation: 51

ios7 navigation bar height resize using storyboard

I just want to use navigation bar in UIViewController.

in iOS7, if we use navigation controller, the navigation bar height is 64px.

but when I use navigation bar in UIViewController, I can't change navigation bar height.

the height is fixed 44px.

How can I change navigation bar's height using Interface builder, not programming?

enter image description here

Apple doesn't support this feature in xcode storyboard?

Upvotes: 1

Views: 9373

Answers (2)

Rob T
Rob T

Reputation: 147

If you add a fixed height constraint to the UINavigationBar using autolayout, changing the height constraint constant will update the nav bar's height. You adjust this in the storyboard using the size inspector.

Before adding fixed height constraint:

nav_bar_before

After adding fixed height constraint:

nav_bar_after

Upvotes: 6

ramsserio
ramsserio

Reputation: 144

You can try this Code:

@interface UINavigationBar (myNave)
- (CGSize)changeHeight:(CGSize)size;
@end


@implementation UINavigationBar (customNav)
- (CGSize)sizeThatFits:(CGSize)size {
    CGSize newSize = CGSizeMake(320,70);
    return newSize;
}
@end

For more info visit : http://tutorialmode.com/ios/customising-an-ios-navigation-bar/

Upvotes: 1

Related Questions