I’m trying to change the text color of a Segmented...
# kotlin-native
c
I’m trying to change the text color of a SegmentedControl with the following:
Copy code
setTitleTextAttributes(attributes = mapOf(UIColor.whiteColor to "foregroundColor"), forState = UIControlStateSelected)
But it is crashing when running the app. Already tried
foregroundColor
,
backgroundColor
and
textColor
but none worked.
What am I doing wrong? Solved it by changing the mapOf, the key was out of place
a
Hello, can you tell a bit more on the error contents?
c
Nevermind, was doing the
mapOf
the other way around. It should be:
Copy code
setTitleTextAttributes(attributes = mapOf("foregroundColor" to UIColor.whiteColor), forState = UIControlStateSelected)
👍 2