iOS 13设置tabbar字体颜色及大小(解决push之后再返回字体变蓝)

  UITabBarItem *item = [UITabBarItem appearance];

    [item setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"],NSFontAttributeName:[UIFont systemFontOfSize:14]} forState:UIControlStateNormal];

    [item setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FF0009"],NSFontAttributeName:[UIFont systemFontOfSize:14]} forState:UIControlStateSelected];

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

      // iOS13 及以上

        self.tabBar.tintColor = [UIColor colorWithHexString:@"#FF0009"];        self.tabBar.unselectedItemTintColor = [UIColor colorWithHexString:@"#333333"];

            }

你可能感兴趣的:(iOS 13设置tabbar字体颜色及大小(解决push之后再返回字体变蓝))