Prudhvi Raj Pampana
Prudhvi Raj Pampana

Reputation: 109

In ios 7 how to increase the size of UINavigation bar

Used storyboard to create navigation bar. and now in ios 7 i have a challenge to increase the height of navigation bar.

UINavigationBar *navBar = [[self navigationController] navigationBar];

[navBar setFrame:CGRectMake(0, 100, 1024, 200)];

Upvotes: 1

Views: 462

Answers (3)

psk
psk

Reputation: 192

Use this -

@implementation UINavigationBar (customNavBar)
- (CGSize)sizeThatFits:(CGSize)size
{
    CGSize navSize = CGSizeMake(self.frame.size.width,200);
    return navSize;
}

Upvotes: 0

user376845
user376845

Reputation:

You can't change the height of the navigation bar. It's fixed at 44 pixels.

Upvotes: 0

Mutawe
Mutawe

Reputation: 6524

UIFont *font = [UIFont fontWithName:@"fontName" size:YourFloatSize];
CGSize titleSize = [title sizeWithFont:font];
UILabel *titleLable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, titleSize.width, titleSize.height)];
titleLable.text = title;
titleLable.textAlignment = NSTextAlignmentCenter;
titleLable.backgroundColor = [UIColor clearColor];
titleLable.textColor = [UIColor anyColorYouWant];

titleLable.font = font;
self.navigationItem.titleView = titleLable;

Upvotes: 2

Related Questions