escoz / QuickDialog

QuickDialog - Quick and easy dialog screens for iOS
http://escoz.com/open-source/quickdialog
Other
3.07k stars 637 forks source link

Touching the cell of a QBooleanElement doesn't change the UISwitch #175

Closed kevinrenskers closed 12 years ago

kevinrenskers commented 12 years ago

When you add a QBooleanElement with a controllerAction, the action is called whenever you change the value of the switch. However, when you touch the tablecell itself, the action is also called, yet the switch is not changed.

escoz commented 12 years ago

This is a tricky thing. It used to work like you want, but after using it for a couple of things, I ended up changing to separate the button from the cell click, so it's more modular.

After you set the boolValue, you need to call [self.quickDialogTableview reloadCellForElements:element] to refresh the cell.

Not sure what the default behavior should be, maybe we make the option to do the other as a setting.

kevinrenskers commented 12 years ago

Aha, I guess that solves #176 as well :)

Even though this workaround works, you need to do this for every QBooleanElement you use... Even the sample app is "broken" like this.

escoz commented 12 years ago

Yup. The tableview is never updated by default and that's by design. Your view controller should really be in charge of updating the view as necessary. You'll need to do this every time you update the table. You can also call table.reloadData if you want to refresh the entire thing at once.

kevinrenskers commented 12 years ago

Fair enough, good to know :)

Also, for people finding this in the future: the method is nil-terminated like this: [self.quickDialogTableView reloadCellForElements:sender, nil];