tabbar 设置选中文字的颜色

 

// - 被废弃了 会有警告

self.tabBar.selectedImageTintColor = [UIColororangeColor];


// - 最新的使用方法

NSMutableDictionary *textAttrs = [NSMutableDictionarydictionary];

    textAttrs[NSForegroundColorAttributeName] =HWColor(123,123, 123);

    

    NSMutableDictionary *selectTextAttrs = [NSMutableDictionarydictionary];

    selectTextAttrs[NSForegroundColorAttributeName] = [UIColororangeColor];

    

    [childVc.tabBarItemsetTitleTextAttributes:textAttrs forState:UIControlStateNormal];

    [childVc.tabBarItemsetTitleTextAttributes:selectTextAttrs forState:UIControlStateSelected];




// - 设置选中的图片 图片不被渲染

childVc.tabBarItem.selectedImage = [[UIImageimageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];


你可能感兴趣的:(tabbar 设置选中文字的颜色)