我的项目有- (void)changeColor{
[[UISegmentedControl appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor colorWithRed:83.0f/255.0f green:198.0f/255.0f blue:255.0f/255.0f alpha:1.0]} forState:UIControlStateSelected];
[[UISegmentedControl appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor colorWithRed:197.0f/255.0f green:197.0f/255.0f blue:197.0f/255.0f alpha:1.0]} forState:UIControlStateNormal];
}
。我有灰色分色器。
vector <int> vec1 = {1,2,3,4,5,6,7,8,9,10};
vector <int> vec2 = vec1;
答案 0 :(得分:3)
您必须使用图像进行设置。请注意,您可以在选定和未选定的段之间或两个未选择的段之间使用单独的分隔符。
UISegmentedControl.setDividerImage(_:forLeftSegmentState:rightSegmentState:barMetrics:)
使用UISegmentedControl
的Intead我发现使用一组UIControl
元素更简单。