escoz / QuickDialog

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

Change the value of a QBooleanElement within the controllerAction #176

Closed kevinrenskers closed 12 years ago

kevinrenskers commented 12 years ago

Sometimes when the user changes a QBooleanElement/UISwitch, I have to be able to alert the user that this action isn't possible and reset the value of the switch. However, changing the value of the boolValue property doesn't impact the value of the UISwitch.

QBooleanElement *switch = [[QBooleanElement alloc] initWithTitle:@"Do this?" BoolValue:NO];
switch.controllerAction = @"toggleChanged:";

- (void)toggleChanged:(QBooleanElement *)sender {
    if (cannotdothis) {
        sender.boolValue = NO;
        NSLog(@"Can't do it");
    }
}
kevinrenskers commented 12 years ago

Workaround:

[self.quickDialogTableView reloadCellForElements:sender, nil];