zoukankan      html  css  js  c++  java
  • iOS设置图片名称、启动图片、防止TabBar图片和文字渲染

    设置App的名称

    设置App的启动图片

    需要注意点是,App要杀掉重启才能显示出启动图片

    2种方法防止图片被渲染

    1.

    vc02.tabBarItem.image = [UIImage imageNamed:@"tabBar_new_icon"];
    UIImage *image = [UIImage imageNamed:@"tabBar_new_click_icon"];
    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    vc02.tabBarItem.selectedImage = image;

    2.

    文字被渲染解决方法

    1.

    vc02.tabBarItem.title = @"新帖";
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    attrs[NSForegroundColorAttributeName] = [UIColor grayColor];
    [vc02.tabBarItem setTitleTextAttributes:attrs forState:UIControlStateNormal];
    NSMutableDictionary *attrs1 = [NSMutableDictionary dictionary];
    attrs1[NSForegroundColorAttributeName] = [UIColor blackColor];
    [vc02.tabBarItem setTitleTextAttributes:attrs1 forState:UIControlStateSelected];

    2.

    • 通过appearance统一设置所有UITabBarItem的文字属性
    • 后面带有UI_APPEARANCE_SELECTOR的方法,都可以通过appearance对象来统一设置
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    dic[NSForegroundColorAttributeName] = [UIColor grayColor];
    
    NSMutableDictionary *selectedDic = [NSMutableDictionary dictionary];
    selectedDic[NSForegroundColorAttributeName] = [UIColor darkGrayColor];
    
    UITabBarItem *item = [UITabBarItem appearance];
    [item setTitleTextAttributes:dic forState:UIControlStateNormal];
    [item setTitleTextAttributes:selectedDic forState:UIControlStateSelected];

     

  • 相关阅读:
    hihocoder 1142 三分·三分求极值(三分)
    poj 3304 Segments(计算直线与线段之间的关系)
    poj 1269 Intersecting Lines(判断两直线关系,并求交点坐标)
    poj 2398 Toy Storage(计算几何 点线关系)
    poj 2318 TOYS(计算几何 点与线段的关系)
    计算几何基础(模板)
    Jmeter-基本组成
    java-面向对象
    性能测试基础
    java-多线程
  • 原文地址:https://www.cnblogs.com/-yun/p/6961722.html
Copyright © 2011-2022 走看看