I want to set colors for the text and background of UISegmentedControl. So I've four colors to set, the default and selected color of the text and background.
I can use tintColor
and backgroundColor
to set the background. But how to set the default text color, not same as the tint color?
Note: here is swift3 not the older language. I'm a beginner of ios, I just start from the swift3, have no experience of the former language.
Any help will be appreciated.
UISegmentedControl.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.redColor()], forState: .Selected)