How to change the color of the tab button and the view itself in NSTabView?

♀尐吖头ヾ 提交于 2019-12-03 23:06:28
Roy Falk

After a couple of hours, I think you can't do it with NSTabView. The documentation says you can no longer do it and NSTabView will respect the theme chosen by the OS instead.

This led me to How to draw your own NSTabView tabs?, which I'm sure you've seen. But despite the documentation, SetImage/ForSegment did not work for me.

[NSSegmentedControl Colors seems to have found one solution, and SMSegmentView is another, although there may be licensing issues. Both these solutions are more recent.

I hope the above will prove useful to you and good luck.

the following code is the one that i use for doing that, working right now with iOS 9

[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:(44/255.00) green:(71/255.00) blue:(95/255.00) alpha:1]]; //TAB BAR TINT COLOR
[[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor whiteColor]];
[[UITabBar appearance] setTintColor:[UIColor colorWithRed:(249/255.00) green:(153/255.00) blue:(44/255.00) alpha:1]];//BUTTON TINT COLOR
[[UITabBar appearance] setTranslucent:NO];
[[UITabBar appearance] setAlpha:1];

And the result is something like this

Image from the tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!