修改TabBarViewController上标题字体颜色


  UINavigationController *newNavVc = [[UINavigationController alloc]init];

    newNavVc.title = title;

    newVc.title = title;

    //设置TabBar上标题的字体颜色

    NSMutableDictionary *dictAttr = [NSMutableDictionary dictionary];

    //dictAttr[NSForegroundColorAttributeName] = [UIColor orangeColor];

    //dictAttr[NSFontAttributeName]=[UIFont systemFontOfSize:13];

     [dictAttr setObject:[UIColor orangeColor] forKey:NSForegroundColorAttributeName];

    [newNavVc.navigationBar setTitleTextAttributes:dictAttr];

    newVc.tabBarItem.title = title;

    newVc.tabBarItem.image = image;

    newVc.tabBarItem.selectedImage = selectImg;

    [newNavVc addChildViewController:newVc];

    //TabBar上的文字选中时变橙色

    [newVc.tabBarItem setTitleTextAttributes:dictAttr forState:UIControlStateSelected];

    [self addChildViewController:newNavVc];


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM