如何在iOS 8中更改UISegmentedControl
的边框宽度?目前,边框宽度为2px,我想将其设置为1px。设置CALayer的边框宽度似乎不起作用。我似乎无法在任何地方找到任何相关信息。
提前感谢您的帮助!
答案 0 :(得分:3)
适用于iOS 8.1
_segmentedControl.layer.borderWidth = 2;
答案 1 :(得分:2)
我建议您根据需要使用自定义分割器图像:
[mySegmentedControl setDividerImage:image1 forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:barMetrics];
[mySegmentedControl setDividerImage:image2 forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:barMetrics];
[mySegmentedControl setDividerImage:image3 forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:barMetrics];