zoukankan      html  css  js  c++  java
  • UINavigationBar统一修改导航条样式

    #pragma mark -- 统一导航条样式

      //统一导航条样式

      UIFont *font = [UIFont systemFontOfSize:19.f];

      NSDictionary *textAttributes = @{

        NSFontAttributeName : font,

        NSForegroundColorAttributeName : [UIColor whiteColor]

      };

      [[UINavigationBar appearance] setTitleTextAttributes:textAttributes];

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

      [[UINavigationBar appearance]

          setBarTintColor:[UIColor colorWithHexString:@"0099ff" alpha:1.0f]];//背景色

     

      [[NSNotificationCenter defaultCenter]

          addObserver:self

             selector:@selector(didReceiveMessageNotification:)

                 name:RCKitDispatchMessageNotification

               object:nil];

        [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-1.5, 0forBarMetrics:UIBarMetricsDefault];

        UIImage *tmpImage = [UIImage imageNamed:@"back"];

        

        CGSize newSize = CGSizeMake(12, 20);

        UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0f);

        [tmpImage drawInRect:CGRectMake(2, -2, newSize.width, newSize.height)];

        UIImage *backButtonImage = UIGraphicsGetImageFromCurrentImageContext();

        UIGraphicsEndImageContext();

        [[UINavigationBar appearance] setBackIndicatorImage:backButtonImage];

        [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backButtonImage];

        if (IOS_FSystenVersion >= 8.0) {

            [UINavigationBar appearance].translucent = NO;

        }

  • 相关阅读:
    CentOS6.4 安装OpenResty和Redis 并在Nginx中利用lua简单读取Redis数据
    nginx缓存批量清除
    Centos下Yum安装PHP5.5,5.6
    php中的脚本加速扩展opcache
    Centos 6.5 挂载硬盘 4K对齐 (笔记 实测)
    centos6.5下编译安装FFmpeg
    Python学习九:列表生成式
    Python Select 解析
    Python之基于socket和select模块实现IO多路复用
    Python之路,Day9 , IO多路复用(番外篇)
  • 原文地址:https://www.cnblogs.com/daxueshan/p/6546676.html
Copyright © 2011-2022 走看看