ios - UISwitch decides if another UITableViewCell is editable -


i have 3 custom table view cell in 1 section. first cell have uiswtich. want when uiswitch on other 2 table view cell's uitextfield editable, otherwise not. possible?

you can adding listener switch, check state, , set editability of 2 text fields there:

// goes viewdidload sw.addtarget(self, action: selector("statechanged:"), forcontrolevents: uicontrolevents.valuechanged)  // function work func statechanged(switchstate: uiswitch) {     if switchstate.on {         textfield1.editable = true         textfield2.editable = true     } else {         textfield1.editable = false         textfield2.editable = false     } } 

i assuming textfield1 , textfield2 outlets referencing uitextfields in 2 table cells.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -