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;

  • 相关阅读:
    做汉堡
    第三次作业:五章感想与问题
    第二次作业:结对练习
    自己要的东西
    存在不知道是什么问题的程序
    第一个Sprint冲刺第二天
    第一个Sprint冲刺第一天
    第三个Sprint完结工作 用场景来规划测试工作.
    beta 阶段的 postmortem 报告
    重新评估团队贡献分
  • 原文地址:https://www.cnblogs.com/zhujin/p/4420476.html
Copyright © 2011-2022 走看看