ios - How to disable UISlider Swift -


i've seen answers no actual code explaining how to, i'm new swift confused on how perform simple task.

i have uislider want disable sliders funcation when if statement true.

i current have uislider if statement can't workout how disable it.

    @ibaction func radiusslider(sender: uislider) {     if location == false {     //disable slider     } else {             radiusdata.radiusvalue = double(sender.value)             radiuslabel.text = "radius: \(sender.value)km"             nsnotificationcenter.defaultcenter().postnotificationname(radiusvalue, object: self)     } } 

or in within viewdidload? if how?

all appreciated

set enabled property false.

@ibaction func radiusslider(sender: uislider) {     if location == false {         sender.enabled = false     } else {         radiusdata.radiusvalue = double(sender.value)         radiuslabel.text = "radius: \(sender.value)km"         nsnotificationcenter.defaultcenter().postnotificationname(radiusvalue, object: self)     } } 

if want enable/disable slider in other functions of view controller, need make iboutlet property slider.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -