zoukankan      html  css  js  c++  java
  • UITabBar实现自定义背景及UITabBarItem自定义图片和字体

    UITabBarItem *firstItem = [[UITabBarItem alloc]initWithTitle:@"测试" image:nil tag:11];
        
     //设置字体颜色(后面设置字体状态)(UITextAttributeTextColor已过时)
      [firstItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor grayColor], UITextAttributeTextColor, nil] forState:UIControlStateNormal];

     //设置图片(选中和未选中)(此方法也已过时)
     [firstItem setFinishedSelectedImage:[UIImage imageNamed:@"local"] withFinishedUnselectedImage:[UIImage imageNamed:@"localClick"]];
    #import "MyTabBar.h"
    
    @implementation MyTabBar
    
    - (id)initWithFrame:(CGRect)frame
    {
        self = [super initWithFrame:frame];
        if (self) {
            // Initialization code
            //通过三原色设置背景颜色
            self.backgroundColor = [UIColor colorWithRed:86/250.0f green:140/250.0f blue:158/250.0f alpha:1];
        }
        return self;
    }
    
    
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    - (void)drawRect:(CGRect)rect
    {
        // Drawing code
    }
    
    
    @end
  • 相关阅读:
    JavaScript之正则表达式
    BOM之本地数据存储
    BOM之定时器
    BOM之window核心模块
    BOM简介
    DOM之元素定位
    DOM之事件
    DOM之节点操作
    DOM简介
    linux机制
  • 原文地址:https://www.cnblogs.com/hw140430/p/3713378.html
Copyright © 2011-2022 走看看