修改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];

posted @ 2016-10-22 20:58  IOSyes  阅读(2330)  评论(0编辑  收藏  举报