的颜色修改,标题大小和UIBarButtonItem字体大小

 

 

  1. 修改navigationBar 字体颜色

上面那种作用,(不精晓怎么设置作品格式,写的可比随意,请见谅)

  设置全局导航栏颜色,标题大小和UIBarButtonItem字体大小

在appdelegate里面安装

swift:

UINavigationBar.appearance().barTintColor = UIColor.init(red: 47, green: 48, blue: 52)

        UINavigationBar.appearance().tintColor = UIColor.whiteColor()

        UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont.boldSystemFontOfSize(18),NSForegroundColorAttributeName: UIColor.whiteColor()]

        UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont.boldSystemFontOfSize(15),NSForegroundColorAttributeName: UIColor.whiteColor()], forState: UIControlState.Normal)

 

oc:

#pragma mark –  设置全局重返开关,无文字

    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)

                                                      
  forBarMetrics:UIBarMetricsDefault];

 

1旦急需设置导航栏颜色,使barItem颜色也被渲染了,能够那样设置(就能够有限支撑barItem里面图片的颜色不被渲染了)

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage: [[UIImage imageNamed: @”xiaoxi_icon”] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal] style: UIBarButtonItemStylePlain target: self action: @selector(a)];

 

 

如若导航栏与view出现了空子。必要把系统暗许设置空隙值关掉

#pragma 设置调控器,现身私下认可知道空隙

的颜色修改,标题大小和UIBarButtonItem字体大小。//    self.automaticallyAdjustsScrollViewInsets =
NO;

  设置全局导航栏颜色,标题大小和UIBarButtonItem字体大小

在appdelegate里面安装

swift:

UINavigationBar.appearance().barTintColor = UIColor.init(red: 47, green: 48, blue: 52)

        UINavigationBar.appearance().tintColor = UIColor.whiteColor()

        UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont.boldSystemFontOfSize(18),NSForegroundColorAttributeName: UIColor.whiteColor()]

        UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont.boldSystemFontOfSize(15),NSForegroundColorAttributeName: UIColor.whiteColor()], forState: UIControlState.Normal)

 

澳门葡京备用网址,oc:

#pragma mark –  设置全局重回开关,无文字

    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)

                                                      
  forBarMetrics:UIBarMetricsDefault];

 

若果必要安装导航栏颜色,使barItem颜色也被渲染了,能够这么设置(就可以保险barItem里面图片的水彩不被渲染了)

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage: [[UIImage imageNamed: @”xiaoxi_icon”] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal] style: UIBarButtonItemStylePlain target: self action: @selector(a)];

 

 

如若导航栏与view出现了空子。必要把系统暗中认可设置空隙值关掉

#pragma 设置调节器,出现暗中同意识道空隙

//    self.automaticallyAdjustsScrollViewInsets =
NO;

A(第一种). [[UINavigationBar appearance] setBackgroundImage:[UIImage
imageWithColor:[UIColor redColor]]
forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];

澳门葡京备用网址 1

B(第二种).
[self.navigationController.navigationBar setTintColor:[UIColor
redColor]];
[self.navigationController.navigationBar setBarTintColor:[UIColor
redColor]];
[self.navigationController.navigationBar setBackgroundImage:[UIImage
imageWithColor:[UIColor redColor]]
forBarMetrics:UIBarMetricsDefault];

导航栏颜色和分界面背景颜色是同1的,作者是概念了一个宏

  1. 修改系统再次来到按键,字体颜色深浅
    UIImage *backButtonImage = [UIImage imageNamed:@”back”];

    [[UINavigationBar appearance]
    setBackIndicatorImage:backButtonImage];
    [[UINavigationBar appearance]
    setBackIndicatorTransitionMaskImage:backButtonImage];
    [[UINavigationBar appearance] setTintColor:[UIColor
    whiteColor]];

    [[UIBarButtonItem appearance]
    setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin,
    NSIntegerMin) forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance]
    setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor
    whiteColor],NSFontAttributeName:[UIFont
    boldSystemFontOfSize:MZFontNavigationTitleFontSize]}];

一、未有隐藏导航栏

在ios第10中学,假设供给对单个页面修改颜色,在view威尔disapper里面重新载入参数无效[可是手势再次回到有效,再次来到开关重回颜色会有显著扭转],那一年需求在navigationcontroller的秘籍popviewcontrollerxxx(恐怕pushviewcontroller)里面重新初始化导航颜色

二、设置了导航栏的颜色

三、设置了气象栏字体的颜料

肆、隐藏了导航栏的黑线

代码如下:

澳门葡京备用网址 2

澳门葡京备用网址 3

//  导航栏颜色

    [[UINavigationBar appearance]
setBarTintColor:navigationBarColor];

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

    [[UINavigationBar appearance]
setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor
whiteColor],NSFontAttributeName : [UIFont
boldSystemFontOfSize:17]}];

    //  去掉导航黑线

    // [[UINavigationBar appearance]  setBackgroundImage:[[UIImage
alloc] init] forBarPosition:UIBarPositionAny
barMetrics:UIBarMetricsDefault];

    [[UINavigationBar appearance] setShadowImage:[[UIImage alloc]
init]];

// ——- 界面中 —–

self.view.backgroundColor = navigationBarColor;

//设置navigationbar的半透明

[self.navigationController.navigationBar setTranslucent:NO];

//设置景况栏字体颜色为藏蓝

self.navigationController.navigationBar.barStyle =
UIStatusBarStyleLightContent;

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*
*
Website