Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISegmentedControl with square corners

Tags:

I would like to modify UISegmentedControl with a subclass to remove the rounded corners. I can't seem to set the cornerRadius. Making the SegmentedControl wider than the screen (and therefor "chop" off the corners) is not an option since I have 4 or 5 segments and they would then vary in size.

Is there a way to do this?

Thanks

like image 598
Joseph Avatar asked Oct 12 '11 11:10

Joseph


1 Answers

To make the corner square use the following code:

segmentContrl.layer.borderColor=*anycolor*.CGColor; segmentContrl.layer.cornerRadius = 0.0; segmentContrl.layer.borderWidth = 1.5f; 
like image 51
swathy krishnan Avatar answered Sep 27 '22 17:09

swathy krishnan