Is it possible to change the corner radius of UISegmentedControl? I have tried the following approach which we use to change a UIView's corner radius.
self.segmentedControl.layer.cornerRadius = 15.0;
self.segmentedControl.layer.masksToBounds = YES;
This did not work as you can see it only cuts off the UISegmentedControl's corner.
Thanks!
Your result is because something other (custom drawing?) controls the border and not the layer. Luckily it seems that that layer settings have priority.
If you know what border color you need, you can just add (example):
The previous solutions never worked for me. My solution is:
To embed the
UISegmentedControl
inside a superview, then assign -1 to the constraints leading, trailing, bottom, top, in order to cut off theUISegmentedControl
border. Finally the superview should be configured in this way: