zoukankan      html  css  js  c++  java
  • swift 修改 Navigationbar Tabbar 字体颜色背景等属性

    1.navigationBar的设置

    let navColor = UIColor(red: 41/255, green: 160/255, blue: 230/255, alpha: 1)

    func setNavibar() -> Void { self.navigationController?.navigationBar.barTintColor = navColor; self.navigationController?.navigationBar.tintColor = UIColor.white; self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor:UIColor.white,NSAttributedStringKey.font:UIFont.boldSystemFont(ofSize:20)]; self.navigationItem.backBarButtonItem = UIBarButtonItem.init(title: "", style: .plain, target: nil, action: nil); }

    2.tabbar 的设置

            self.tabBar.barTintColor=UIColor.gray;
            //.设置底部工具栏文字颜色(默认状态和选中状态)(选中状态为蓝色)
            UITabBarItem.appearance().setTitleTextAttributes(NSDictionary(object:UIColor.white, forKey:NSForegroundColorAttributeName as NSCopying) as? [String : AnyObject], for:UIControlState.normal);
            UITabBarItem.appearance().setTitleTextAttributes(NSDictionary(object:UIColor.blue, forKey:NSForegroundColorAttributeName as NSCopying) as? [String : AnyObject], for:UIControlState.selected)

    tabbar 选中照片的颜色

        var image:UIImage = UIImage(named: imageName)!  
           var selectedimage:UIImage = UIImage(named: selectImageName)!;  
           image = image.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);  
           selectedimage = selectedimage.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);  
           vc.tabBarItem.image = image  
           vc.tabBarItem.selectedImage = selectedimage  
  • 相关阅读:
    cocos2dx的MotionStreak.cpp解析(-)
    gcc/g++基本命令简介
    C++编译器与链接器工作原理
    简单介绍 ARC 以及 ARC 实现的原理
    求两个链表表示的数的和
    对象内存结构中的 isa 指针是用来做什么的?
    按层遍历二叉树的节点
    一个 Objective-C 对象的内存结构是怎样的?
    创建一个可以被取消执行的 block
    TCP&UDP
  • 原文地址:https://www.cnblogs.com/Bob-blogs/p/7743761.html
Copyright © 2011-2022 走看看