- (void)save:(id)sender
{
UITableViewCell *commentCell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
UISwitch* commentSwitch = (UISwitch*)[commentCell viewWithTag:2];
NSLog(@"%@", [NSNumber numberWithBool:commentSwitch.on]);
}
ios7 how can I get UITableViewCell's UISwitch value?
-
06-10-2022 - |
Question
I'm using UISwitch on UITableViewCell. When I the push save button, I want to get UISwitch value. How can I get it? My code listed below:
- (void)save:(id)sender
{
UITableViewCell *commentCell = [self.tableView dequeueReusableCellWithIdentifier:@"CustomInfoCell" forIndexPath: [NSIndexPath indexPathForRow:0 inSection:0]];
UISwitch* commentSwitch = (UISwitch*)[commentCell viewWithTag:2];
NSLog(@"%@", [NSNumber numberWithBool:commentSwitch.on]);
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow