设置导航颜色

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:1]];

[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)];

设置导航文字颜色

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

设置导航背景

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_bg.png"] forBarMetrics:UIBarMetricsDefault];

设置多个导航按钮

UIBarButtonItem *shareItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:nil];

UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:nil];

NSArray *actionButtonItems = @[shareItem, cameraItem];

self.navigationItem.rightBarButtonItems = actionButtonItems;

设置导航字体

NSShadow *shadow = [[NSShadow alloc] init];

shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];

shadow.shadowOffset = CGSizeMake(0, 1);

[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName, shadow, NSShadowAttributeName, [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];

说法二:

方法1

导航向上添加一个titleView,可以使用一个label,再设置label的背景颜色透明,字体什么的设置就很简单了。

//自定义标题视图

UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];

titleLabel.backgroundColor = [UIColor grayColor];

titleLabel.font = [UIFont boldSystemFontOfSize:20];

titleLabel.textColor = [UIColor greenColor];

titleLabel.textAlignment = NSTextAlignmentCenter;

titleLabel.text = @"新闻";

self.navigationItem.titleView = titleLabel;

方法2

//    设置 标题的颜色和字号

[self.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:2

0],NSForegroundColorAttributeName:[UIColor whiteColor]}];

self.navigationBar.barTintColor =[UIColor whiteColor]];

设置tabbar的背景颜色

self.tabBar.barTintColor = [UIColor whiteColor];

UINavigationBar导航栏相关设置的更多相关文章

  1. 导航栏视图设置 tabbleView 是设置总背景图

    //导航栏视图设置 tabbleView 是设置总背景图 //默认的时白色半透明(有点灰的感觉), UIBarStyleBlack,UIBarStyleBlackTranslucent ,UIBarS ...

  2. iOS状态栏、导航栏的设置

    简单的参考 1.状态栏(statusBar) 默认:黑色 改变为白色: 1.1 第一步: info.plist中添加View controller-based status bar appearanc ...

  3. IOS 导航栏属性设置

    IOS 7 以上系统导航栏: [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; // 返回按钮颜色 [UINaviga ...

  4. UINavigationController导航栏按钮设置

    UINavigationController常见属性 1.一般情况下,导航栏上面显示什么内容,由当前栈顶控制器的navigationItem属性决定 * navigationItem.title : ...

  5. Swift 导航栏设置

    let width = UIScreen.mainScreen().bounds.size.width let height = UIScreen.mainScreen().bounds.size.h ...

  6. App开发流程之状态栏和导航栏

    记录状态栏和导航栏的设置和控制,统一在基类视图控制器中完成. 状态栏. 状态栏高度为20,iOS7以后背景完全透明. 样式枚举如下: typedef NS_ENUM(NSInteger, UIStat ...

  7. iOS系统中导航栏的转场解决方案与最佳实践

    背景 目前,开源社区和业界内已经存在一些 iOS 导航栏转场的解决方案,但对于历史包袱沉重的美团 App 而言,这些解决方案并不完美.有的方案不能满足复杂的页面跳转场景,有的方案迁移成本较大,为此我们 ...

  8. 【转】【iOS】导航栏那些事儿

    原文网址:http://www.jianshu.com/p/f797793d683f 参考文章 navigationItem UINavigationItem UINavigationBar UIBa ...

  9. 小程序--改变子级别页面导航栏信息 / navigationBarTitleText

    微信小程序在公共文件app.json中设置了导航栏相关样式如下: 其中  navigationBarTitleText 为设置导航栏名称,若是想子级页面和父页面的header页面不同,则在子级文件中新 ...

随机推荐

  1. 转:基于Webrtc的跨平台实时语音通信解决方案(讲座)

    转:http://edu.csdn.net/course/detail/320/

  2. Quartz Scheduler(2.2.1) - hello world

    简单示例 1. maven 依赖 <dependencies> <dependency> <groupId>org.quartz-scheduler</gro ...

  3. 蒋金楠How ASP.NET MVC Works?[持续更新中…]

    一.ASP.NET + MVC IIS与ASP.NET管道 MVC.MVP以及Model2[上篇]  MVC.MVP以及Model2[下篇] ASP.NET MVC是如何运行的[1]: 建立在“伪”M ...

  4. Win32非递归遍历和搜索文件以及目录算法

    转载请注明来源:http://www.cnblogs.com/xuesongshu 要点: 1.搜索的顶层目录在进入循环之前进栈 2.栈元素存储字符串指针,出栈时释放资源 3.每次循环开始,栈顶元素出 ...

  5. Cocos2d-x使用UserDefault数据持久化实例:保存背景音乐和音效设置

    UserDefault可以实现数据的存储,但是它的使用不能泛滥,具体讲一般情况下不会使用它保存大量的数据,它没有SQL语句那样的灵活.UserDefault除了保存游戏设置外,还有可以长期保持游戏精灵 ...

  6. Quartz2D 图像处理

    首先感谢一片枫叶总结出这么好的文章,文章出处:http://www.cnblogs.com/smileEvday/archive/2013/05/25/IOSImageEdit.html 本文将为大家 ...

  7. block的动态传值例子

    /*  写一个block传值  ,让两个数进行相除和相乘,在运行时动态决定采用哪种计算方式 */ #import <Foundation/Foundation.h> int main(in ...

  8. private继承

    private继承并不如public继承一样具有is-a的关系. ------------------------------------------------------------------- ...

  9. Wininet笔记一

    1, InternetOpen 创建根句柄,由下一层的 InternetOpenUrl 和 InternetConnect 使用,而 InternetConnect 创建的句柄又被之后的几个函数使用. ...

  10. windows下nginx以服务自启动

    1,下载最新版的 Windows Service Wrapper 程序,例如:"winsw-1.9-bin.exe" 也可以修改它的名字,例如:myapp.exe 2, 将重命名后 ...