[self.navigationController.navigationBar setShadowImage:[Static ColorToImage:[Static colorWithHexString:[UIColor red]]]];

Static 里的几个静态方法

+ (UIImage *)ColorToImage:(UIColor *)color{

    CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [color CGColor]);

    CGContextFillRect(context, rect);

    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return theImage;

}
+ (UIColor *) colorWithHexString: (NSString *)color{

    NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];

    if ([cString length] < ) {

        return [UIColor clearColor];

    }

    if ([cString hasPrefix:@"0X"])

        cString = [cString substringFromIndex:];

    if ([cString hasPrefix:@"#"])

        cString = [cString substringFromIndex:];

    if ([cString length] != )

        return [UIColor clearColor];

    // 拆分

    NSRange range;

    range.location = ;

    range.length = ;

    //R

    NSString *rString = [cString substringWithRange:range];

    //G

    range.location = ;

    NSString *gString = [cString substringWithRange:range];

    //B

    range.location = ;

    NSString *bString = [cString substringWithRange:range];

    //Scan

    unsigned int r, g, b;

    [[NSScanner scannerWithString:rString] scanHexInt:&r];

    [[NSScanner scannerWithString:gString] scanHexInt:&g];

    [[NSScanner scannerWithString:bString] scanHexInt:&b];

    return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:1.0f];

}

修改NavigationBar的分根线颜色的更多相关文章

  1. silverlight chart 折线图 的线颜色如何修改???

    silverlight  chart 折线图 的线颜色如何修改??? 我做出来都是这些偏黄色,请问如何修改线的颜色,以及线的宽度?谢谢

  2. NavigationBar的显隐和颜色设置

    [self.navigationController setNavigationBarHidden:NO animated:NO]; self.navigationController.navigat ...

  3. table 上下左右 4根线的写法 :before :after 他们就能把td里面右下的那颗线给盖上 还有body和header横向滚动的联动 || 不能把body套在header上是为了上header表头固定 || 还有表头header的右侧overflow-y 是否出现滚动条的位置 记得有一个$nextTick 要不然会获取不到高度 高度就为0了 || 横向滚动条纵向滚动条

    table 上下左右 4根线的写法 <!--* @description 重点查核人员表!--><template> <div class="keyChecke ...

  4. iOS史上最简单修改导航栏分隔线颜色方法!!!

    override func viewDidLoad() { super.viewDidLoad() if let imageView = self.findNavLineView(view: navi ...

  5. swift 修改 Navigationbar Tabbar 字体颜色背景等属性

    1.navigationBar的设置 let navColor = UIColor(red: 41/255, green: 160/255, blue: 230/255, alpha: 1) func ...

  6. MFC 修改各种控件的背景颜色、字颜色和字体

    今天主要总结一下有关MFC 中静态编辑框(StaticEdit).编辑框(Edit)和按钮(Button)的背景颜色.字颜色和字体. 我的程序运行结果如下: 由上图我们知道修改的地方有:1.把Stat ...

  7. 怎么样修改PHPStorm中文件修改后标签和文件名的颜色与背景色

    自从最近在PHPstrom里引入Git,并且使用MONOKAI_SUBLIME主题之后 ,当文件在PHPstrom中进行编辑,文档内容变化时,左侧项目文件列表中的文件名颜色以及右侧编辑区域标签卡的文件 ...

  8. 修改delphi xe6 FMX Label字体颜色

    delphi fmx的字体等设置默认与皮肤有关,用代码直接修改字体颜色等是无效的,如何才能用代码修改呢?请按以下方法就可以: 1.在Object inspector中取消StlyedSettings中 ...

  9. 修改tabbarcontroller选中图片及选中颜色

    1.修改选中图片: UITabBarItem* item = [self.tabBarController.tabBar.items objectAtIndex:1];   //从0开始 item.s ...

随机推荐

  1. IE10/11 滚动条自动隐藏~

    原文: http://www.cnblogs.com/xwgli/p/4463184.html 就是IE10/11滚动条自动隐藏咯~ 原因是bootstrap里面加了一句: @-ms-viewport ...

  2. pip install read time-out

    Problem ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out. 1 S ...

  3. NFC读卡APP

    # 设计文档 ### 简介----------------------------- 这个APP的功能是使用手机的NFC读卡器功能,做到读取卡片支持M1卡和CPU卡. ### 功能列表-------- ...

  4. linux 安装开启SNMP协议,最下面是yum安装

    Linux SNMP 以下的示例采用SUSE10 Linux环境,但它同样适用于其它Linux发行版. 编译和安装 首先我们需要下载Net-SNMP的源代码,选择一个版本,比如5.7.1,地址如下: ...

  5. HDFS Federation客户端(viewfs)配置攻略

    转自:http://dongxicheng.org/hadoop-hdfs/hdfs-federation-viewfs/ 1. HDFS Federation产生背景 在Hadoop 1.0中,HD ...

  6. php json包 Services_JSON-1.0.2 1 ---one

  7. thinkphp 使用外部php或html 原理

  8. ubuntu16.04 安装opencv3.2.0以及opencv_contrib-3.2.0

    1.需要的包:sudo apt-get install build-essentialsudo apt-get install cmake git libgtk2.0-dev pkg-config l ...

  9. Spring Cloud的子项目,大致可分成两类

    Spring Cloud的子项目,大致可分成两类,一类是对现有成熟框架”Spring Boot化”的封装和抽象,也是数量最多的项目:第二类是开发了一部分分布式系统的基础设施的实现,如Spring Cl ...

  10. php -- strpos,stripos,strrpos,strripos,strstr,strchr,stristr,strrchr

    strpos() 函数 语法: mixed strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) 查找 needle 在 h ...