更改UINavigationBar高度 [英] Change UINavigationBar Height

查看:118
本文介绍了更改UINavigationBar高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何更改导航栏高度吗?

Can some one tell me how to change the navigation bar height?

这是我到目前为止:

CGFloat navBarHeight = 10;
self.navigationController.navigationBar.frame.size.width = navBarHeight;


推荐答案

$ c> UINavigationBar 像这样

You can create a category class based on UINavigationBar like this

.h文件

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

和.m文件

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

效果非常好。

这篇关于更改UINavigationBar高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆