mercredi 24 juin 2015

Looping Through UITableView with custom UITableViewCells

I'm making an app with a settings page that is set up as a UITableView with custom cells. These cells are set up like this:

I need to loop through a table of these cells each time one of the switches is changed. Here is the code I was trying to use to do this:

for var x = 0; x < preferredDistances.count; x++ {

            var indexPath = NSIndexPath(forRow: x, inSection: 0)

            let cell : SettingsCell = settingsTable.cellForRowAtIndexPath(indexPath) as! SettingsCell

            if cell.settingsCellSwitch.on {


When trying to loop through the UITableView with this code, my cell return nil. What am I doing wrong in this block of code and how can I fix it?

See more ..

Aucun commentaire:

Enregistrer un commentaire