Basically I have a tableView like this:
Now, I have an NSDictionary with the keys (title of cell) and objects (UISwitch.on).
I would like to make it so that when I click a switch, it should change the object's value accordingly (YES = ON, NO = OFF).
Different question, I've created the UISwitch so it has a function and the it's called when something's switched:
[switchView addTarget:self action:@selector(switchChanged:)
forControlEvents:UIControlEventValueChanged];
- (void) switchChanged:(id)sender {
UISwitch* switchControl = sender;
NSLog( @"The switch is %@", switchControl.on ? @"ON" : @"OFF" );
}
Now I'd like to know, how can I tell in which row was it clicked?