UISegmentedControl iOS 13一起更改UIControlStateSelected和UIControlStateHighlighted的颜色

时间:2019-11-09 13:54:08

标签: ios objective-c react-native react-native-ios uisegmentedcontrol

尝试执行以下操作:

[self setSelectedSegmentTintColor:tintColor];
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]}
                    forState:UIControlStateSelected];
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]}
                    forState:UIControlStateSelected|UIControlStateHighlighted];
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: tintColor}
                    forState:UIControlStateNormal];

但是看来我无法forState:UIControlStateSelected|UIControlStateHighlighted。这是我的标签的外观:

enter image description here

哪个还可以。但是当我按下所选项目时,文本颜色变为白色(淡色):

enter image description here

是否可以为所选和突出显示的文本配置颜色?

0 个答案:

没有答案