UITabBarController

框架定义了UITabBarController的子类JMTabBarController

所有关于UITabBarController的设置都是在JMTabBarController中完成

设置属性

    //未选中的字体颜色
    UIColor *colorUnselect = [UIColor blackColor];
    [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:colorUnselect} forState:UIControlStateNormal];
    //选中的字体颜色
    UIColor *colorSelect = [UIColor redColor];
    [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:colorSelect} forState:UIControlStateSelected];
    //设置不透明
    self.tabBar.translucent = NO;
    //设置背景颜色
    self.tabBar.barTintColor = [UIColor whiteColor];
    //设置背景图片
    [self.tabBar setBackgroundImage:nil];
    //设置阴影图
    [self.tabBar setShadowImage:nil];

一些常用属性设置已经给出,只要做一些修改即可。如果没有,可以在此处自行增加。

设置item

     NSMutableArray *viewControllers = [[NSMutableArray alloc] init];
     HomeViewController *vc1 = [[HomeViewController alloc] initWithStoryboardName:@"Home"];
     JMNavigationController *nav1 = [[JMNavigationController alloc] initWithRootViewController:vc1];
     [self setupBarItem:nav1.tabBarItem normalImageName:@"Tab1" selectImageName:@"Tab1_Select"];
     [nav1.tabBarItem setTitle:@"主页"];
     [viewControllers addObject:nav1];

在setupViewControllers方法中已经给出例子,在此处更改相应的item,并且在图片资源Assets.xcassets中设置tab文件夹下对应的图片


image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 11,145评论 1 32
  • 一、UITabBarController以其相关控件之间的关系 @interface UITabBarContro...
    西门淋雨阅读 3,130评论 0 1
  • 今天要推荐两本书,真的是硬推。 第一本书,《如何改变习惯》,作者斯科特.扬。看下图 书中对改变习惯作了框架性的描述...
    大方芳阅读 1,537评论 0 51
  • 《公虾米——月儿高》 月儿高,挂柳梢。 不见冤家到。 月儿高,花枝摇。 泪珠腮边吊。 月儿高,心底焦。 夜上梦几遭...
    林文信阅读 399评论 9 9
  • 后缗想了想,道:“小儿尚未出生,便已失父,后又随我颠沛流离。唯愿小儿承夏禹之志,诛荡戾气,疆域一统,国家富足,大众...
    雪鹰飞阅读 312评论 0 1