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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -