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  
  • 相关阅读:
    c基础_笔记_1
    python基础_类型_str
    MySQL的btree索引和hash索引的区别
    最大最小距离算法
    vim代码格式化插件clang-format
    Linux文件检索
    linux下视频转gif
    linux下直接复制文件内容到剪切板
    vim中的分屏操作
    为archlinux终端ls不同类型文件设置不同显示颜色
  • 原文地址:https://www.cnblogs.com/Bob-blogs/p/7743761.html
Copyright © 2011-2022 走看看