我有一个Segmented Control对象,我想改变外边框的颜色,同时保留两个选项之间的界限。我目前有代码:
self.segmentedControl.tintColor = [UIColor whiteColor]; //sets border and text to white
[self.segmentedControl setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor darkGrayColor]} forState:UIControlStateNormal]; //sets selected segment text to dark grey
但是,此代码还将两个选项之间的行设置为白色。有没有办法改变外边框的颜色,还是我只需要将两个按钮放在一起?
答案 0 :(得分:0)
UISegmentedControl没有您所说的选项。您必须使用UIViews,UIButtons或UILabels等实现自己的自定义分段控制器。
答案 1 :(得分:0)
通过这种方式你可以做到:
segControl.tintColor = [UIColor whiteColor];
如果要更改文本颜色白色,请使用以下代码段:
[segControl setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateNormal];