swift - UISegmented Controller -
i have segmented controll set programatically im trying save result string further use
the code segmented control below im having issues can help?
let genderselector: uisegmentedcontrol = { let genderselect = uisegmentedcontrol() genderselect.insertsegment(withtitle: "male", at: 0, animated: true) genderselect.insertsegment(withtitle: "female", at: 1, animated: true) genderselect.tintcolor = uicolor.black return genderselect }()
try this:-
let items = ["male", "female"] let customsc = uisegmentedcontrol(items: items) customsc.selectedsegmentindex = 0 let frame = uiscreen.mainscreen().bounds customsc.frame = //your frame customsc.tintcolor = uicolor.blackcolor() customsc.addtarget(self, action: "yourmethod:", forcontrolevents: .valuechanged) self.view.addsubview(customsc)
Comments
Post a Comment