zoukankan      html  css  js  c++  java
  • TabBarItem修改文字颜色失效

    • 最近在学习Swift, 起了个项目, 发现了tabBarItem未选中状态文字的颜色不起作用了, 默认的是系统的灰色
    UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.green], for: .selected)
    UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.red], for: .normal)
    

    问了下, 有人说是iOS13的问题, 具体是不是iOS 13的问题, 自己没有去认证

    解决方案

    iOS 13下 UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.red], for: .normal)设置normal状态的属性已经不起作用了, 苹果这通瞎几把搞, 不难受吗

    tabBar.tintColor = UIColor.blue
    // 通过UITabBar.appearance() 点不出unselectedItemTintColor属性, 可以直接硬敲
    // UITabBar.appearance().unselectedItemTintColor = UIColor.red
    tabBar.unselectedItemTintColor = UIColor.red
    

    或者

    UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.green], for: .selected)
    tabBar.unselectedItemTintColor = UIColor.red
    

  • 相关阅读:
    web.xml配置文件
    数组去重问题
    Mysql优化
    点赞功能
    IDEA的一些使用小技巧
    Maven
    AJAX
    HTTP响应头拆分/CRLF注入详解
    对寄存器ESP和EBP的一些理解
    汇编调用指令的执行过程
  • 原文地址:https://www.cnblogs.com/gchlcc/p/12564110.html
Copyright © 2011-2022 走看看