zoukankan      html  css  js  c++  java
  • iOS 13 tabbar 字体颜色更改

    更改 tabbar 字体颜色有两种方法:

    第一种:

    [tabbarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:selectColor} forState:UIControlStateSelected];

    此方法在 iOS 13 会有 bug,当我们 push 到下一页再次返回时 tabbar 字体颜色设置会失效。

    第二种:

    self.tabBar.tintColor = selectColor;

    此方法在 iOS 13 可以使用,不会出现问题。

    ps:

    ios 13中使用富文本设置tabbar默认颜色异常

    [obj.tabBarItem setTitleTextAttributes:@{NSFontAttributeName:[UIFont customWithName:@"PingFangSC-Regular" size:10],NSForegroundColorAttributeName:[UIColor blackColor]} forState:UIControlStateNormal];

            [obj.tabBarItem setTitleTextAttributes:@{NSFontAttributeName:[UIFont customWithName:@"PingFangSC-Regular" size:10],NSForegroundColorAttributeName:[UIColor colorWithHex:@"#2C68FF"]} forState:UIControlStateSelected];

    修改:

    if (@available(iOS 10.0, *)) {

            self.tabBar.unselectedItemTintColor = [UIColor blackColor];

            self.tabBar.tintColor = [UIColor colorWithHex:@"#2C68FF"];

        } else {

            // Fallback on earlier versions

        }

  • 相关阅读:
    oracel 复制A列的内容到列
    视图转为表
    面向对象
    银弹效应
    解决linux删除文件后空间没有释放问题
    HttpAnalyzerStdV7安装教程
    HttpUploader6.2-process版本
    Chrome浏览器控件安装方法
    Firefox浏览器控件安装方法
    通达OA整合教程
  • 原文地址:https://www.cnblogs.com/Im-Victor/p/13343498.html
Copyright © 2011-2022 走看看