zoukankan      html  css  js  c++  java
  • WRNavigationBar 使用记录

    最近在做一个导航栏透明度渐变的效果,发现

    WRNavigationBar库很好用,一开始导入到项目,发现导航tiltle颜色一直是黑色的,无论怎么用系统方法改都改不了。后来发现原来库里面有一个方法可以设置默认颜色。

     // 下面是直接用WRNavigationBar 处理导航栏的透明度
        MainNavBarColor = [UIColor colorWithRed:0/255.0 green:175/255.0 blue:240/255.0 alpha:1];
        MainViewColor   = [UIColor colorWithRed:126/255.0 green:126/255.0 blue:126/255.0 alpha:1];
        
        // 设置导航栏默认的背景颜色
        [WRNavigationBar wr_setDefaultNavBarBarTintColor:[UIColor blackColor]];
        // 设置导航栏所有按钮的默认颜色
        [WRNavigationBar wr_setDefaultNavBarTintColor:[UIColor whiteColor]];
        // 设置导航栏标题默认颜色
        [WRNavigationBar wr_setDefaultNavBarTitleColor:[UIColor whiteColor]];
        // 统一设置状态栏样式
        [WRNavigationBar wr_setDefaultStatusBarStyle:UIStatusBarStyleLightContent];
        // 如果需要设置导航栏底部分割线隐藏,可以在这里统一设置
        [WRNavigationBar wr_setDefaultNavBarShadowImageHidden:YES];

    其实如果只是想设置透明导航栏 不想下拉滑动下面的table时导航栏变化的话,这个也可以:

    //- (void)viewWillAppear:(BOOL)animated{
    //
    //    //设置导航栏背景图片为一个空的image,这样就透明了
    //    [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
    //
    //    //去掉透明后导航栏下边的黑边
    //    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
    //}
    
    //- (void)viewWillDisappear:(BOOL)animated{
    //
    //    //如果不想让其他页面的导航栏变为透明 需要重置
    //    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    //    [self.navigationController.navigationBar setShadowImage:nil];
    //}
    此文仅为鄙人学习笔记之用,朋友你来了,如有不明白或者建议又或者想给我指点一二,请私信我。liuw_flexi@163.com/QQ群:582039935. 我的gitHub: (学习代码都在gitHub) https://github.com/nwgdegitHub/
  • 相关阅读:
    架构设计流程:评估和选择备选方案
    架构设计流程:设计备选方案
    架构设计三原则
    迭代器模式(电视机遥控器)
    外观模式
    5.组合模式
    完成动物识别,自行拍摄动物图片进行上传并查看结果
    4.桥接模式 (毛笔和颜色)
    企业沟通机制
    完成植物识别,自行拍摄植物图片进行上传并查看结果
  • 原文地址:https://www.cnblogs.com/liuw-flexi/p/9062542.html
Copyright © 2011-2022 走看看