ios - Highlighting a active Segmented Control + adding a border around the active segment -


i trying create boarder around selected segmentedcontrol item. code have creating border looking for, creating both buttons in segmented control:

here code:

sender.layer.bordercolor = uicolor(white: 1.0, alpha: 1.0).cgcolor sender.layer.borderwidth = 4 

i trying show border around selected segmentedcontrol.

i believe need use either setselected or isselected try , have border around active controller. need little more guidance.

uisegmentedcontrol has subviews each of buttons, can access subviews array:

(mysegmentedcontrol.subviews[mysegmentedcontrol.selectedsegmentindex] as! uiview).layer.borderwidth = 4 

of course, have set normal borderwidth when selection changes.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -