自定义导航条的颜色

才发现,导航条的颜色是可以进行修改的。

#import "AppDelegate.h"
#import "RootViewController.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.

    RootViewController *rootVC=[[RootViewController alloc]init];
    UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:rootVC];

   // UIBarMetricsDefault:用竖着(拿手机)时UINavigationBar的标准的尺寸来显示UINavigationBar.
    //UIBarMetricsLandscapePhone:用横着时UINavigationBar的标准尺寸来显示UINavigationBar
    [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"1.jpg"] forBarMetrics:UIBarMetricsDefault];

    self.window.rootViewController=nav;

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

自定义导航条的颜色

时间: 2024-08-24 01:03:17

自定义导航条的颜色的相关文章

自定义导航条上的标题文字的大小以及颜色

在做项目开发时,有的时候回自定义导航条视图,常见的是设置标题文字的大小颜色.左侧以及右侧navgationItem. 在做自定义导航视图的时候 ,导航项都可以用自定义视图的形式自定义. 自定义导航条标题的时候有两种方法:一是,采用自定义视图的方式:二是,采用系统的方法. 采用自定义视图view的方式 就是在导航向上添加一个titleView,可以使用一个label,再设置label的背景颜色透明,字体什么的设置就很简单了. UILabel *titleLabel = [[UILabel allo

UINavigationController改变UINavigationBar导航条标题颜色跟字体

UINavigationController改变UINavigationBar导航条标题颜色和字体 iOS 5 以后 UINavigationController 可以 改变UINavigationBar导航条标题颜色和字体 [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed:0 green

关于自定义导航条UIBarButtonItem偏移的问题

在自定义导航条左按钮的时候发现按钮的位置向右偏移,下面给出了解决方法 主要还依赖于UIButton的属性设置 //  设置导航条的左按钮 UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom]; leftButton.frame = CGRectMake(0, 0, 32, 26); leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -13, 0, 0);// 设置按钮

定制导航条的颜色

self.navigationController.navigationBar.barTintColor =[UIColor colorWithRed:70/255.0green:193/255.0 blue:14/255.0 alpha:1.0]; // 设置导航条的透明 //    [self setSelfNavigationBarTranslucent]; //- (void)setSelfNavigationBarTranslucent //{ //    if (self.navig

自定义导航条

/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/ body::-webkit-scrollbar { width: 16px; height: 16px; background-color: red; } /*定义滚动条轨道 内阴影+圆角*/ body::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); border-radius: 10px; background-color: g

自定义导航条 文字大小颜色等 按钮大小图标等 背景色

UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [leftBtn setTitleColor:lightBlue forState:UIControlStateNormal]; leftBtn.backgroundColor = [UIColor clearColor]; leftBtn.frame = CGRectMake(0, 0, 60, 44); [leftBtn addTarget:self actio

自定义 导航条分割线,tabBar分割线颜色(或者是 去掉)

UIView * lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, bgView.frame.size.width, 0.5)]; lineView.backgroundColor = JYEColor(226, 226, 226); [bgView addSubview:lineView]; [self.tabBar setShadowImage:[UIImage new]]; [self.tabBar setBackgroun

可自定义导航条功能案例ios项目源码

可定制的navigationitem ,当我们使用系统的方法设置navigationItem的leftItem或者rightItem时,我们会 发现item位置会有偏差(左边的偏右,右边的偏左).当设置navigationItem的titleView时, 会发现图片被拉伸.因此我对系统的设置方法做了一个简单的封装,可以方便的设置navigationItem 的leftItem,titleView,rightItem并可以自主控制item的偏移量. 效果图: <ignore_js_op> 使用方

导航条的自定义:背景颜色设置,按钮标题图片设置,图片坐标修改

一.修改系统原生导航条 修改导航条背景颜色 self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:@"#2295f2"]; 自定义导航条按钮 self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn-menu-h&q