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