zoukankan      html  css  js  c++  java
  • 使用系统UITabbarItem自定义图片显示原本颜色和自定义文字颜色

    。。。。。。

     

    ThirdViewController *thirdVC = [[ThirdViewControlleralloc]initWithTitle:@"搜索信息"];

        //设置tabbarItem 的图片显示原图颜色;

        thirdVC.tabBarItem = [[UITabBarItemalloc]initWithTitle:@"搜索"image:[[UIImageimageNamed:@"login_usernick"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImageimageNamed:@"login_usernick_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

        

        //一句话改变图片和文字的颜色均为红色选中时候

    //    [[UITabBar appearance]setTintColor:[UIColor redColor]];

        

    //只是设置TabBarItem的字体颜色

        [[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorblackColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateNormal];

        [[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorredColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateSelected];

        

        

        RootNavgationController*nav3 = [[RootNavgationControlleralloc]initWithRootViewController:thirdVC];

        NSArray *VCs= [NSArray arrayWithObjects:nav1,nav2,nav3, nil];

        tabControl.viewControllers = VCs;

        self.window.rootViewController = tabControl;

  • 相关阅读:
    分布式计算原理
    消息的有序性
    CAP再解释
    数据建模
    领导层级的跨越
    如何上云|什么是多机房多活架构
    mysql导出导入数据
    Qt 串口 封装好的类 直接使用
    C++ 在类的定义时初始化非静态变量
    Qt error C3646: 未知重写说明符
  • 原文地址:https://www.cnblogs.com/zhujin/p/4420476.html
Copyright © 2011-2022 走看看