文章标题
2016-04-27 15:22
423 查看
self.navigationController.navigationBar setBarTintColor 与 self.navigationController.navigationBar setTintColor
//设置导航背景图颜色 [self.navigationController.navigationBar setTitleTextAttributes:@{UITextAttributeTextColor:[UIColor redColor]}]; //设置左边和右面UIBarButtonItem [self.navigationController.navigationBar setTintColor:[UIColor redColor]]; //设置 title的颜色 [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,nil]]; //设置NavigationBar背景颜色 [[UINavigationBar appearance] setBarTintColor:[UIColor redColor]]; //@{}代表Dictionary [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}]; //当然也可以设置背景色 [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav_bg.png"] forBarMetrics:UIBarMetricsDefault]; UITextAttributeFont - 字体 UITextAttributeTextColor - 文字颜色 UITextAttributeTextShadowColor - 文字阴影颜色 UITextAttributeTextShadowOffset - 偏移用于文本阴影 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 nil]]; //设置为View self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"appcoda-logo.png"]]; //同时设置两个 UIBarButtonItem *shareItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action: nil nil]; UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action: nil nil]; NSArray *itemsArr = @[shareItem,cameraItem]; self.navigationItem.rightBarButtonItems = itemsArr;
相关文章推荐
- NetworkInterface获取主机ip,判断内外网
- 啊哈!算法—小哼买书
- utf8汉字编码16进制对照
- 工具类整理 php 文件处理 二维码生成 laravel 移动设备判断
- JS代码随机生成姓名、手机号、身份证号、银行卡号
- Java中xml2json,json2xml
- ubuntu下设置开机自动挂载硬盘
- SQL Sever触发器的基本语法与作用
- 处理事情的8个牛人方法
- HTTP网络连接相关知识整理(二):网络IO
- hdu2768Cat VS Dog(最大独立集)
- 肺部胸片图像掩膜和伪彩色处理matlab
- Python数据分析学习笔记四
- House Robber III
- 能PIN通对方,对方却ping不通本机的问题
- nagios插件脚本check_linux_stats.pl 安装
- 介绍Android Studio上的几个插件
- 确保一个程序只存在一个实例运行
- div居中问题
- 释伴:Linux 上的 Shebang 符号(#!)