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

 

相关文章:

  • 2021-08-30
  • 2021-10-29
  • 2022-03-08
  • 2021-09-15
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2021-12-07
  • 2021-05-20
  • 2021-08-07
  • 2022-01-16
  • 2021-06-25
相关资源
相似解决方案