Skip to content

Instantly share code, notes, and snippets.

@zeedark
Created October 17, 2012 09:22
Show Gist options
  • Save zeedark/3904649 to your computer and use it in GitHub Desktop.
Save zeedark/3904649 to your computer and use it in GitHub Desktop.
UISwitch on an Accessory View of a UITableCellViewController
UISwitch * uis = [[[UISwitch alloc] init] autorelease];
[uis addTarget:self action:@selector(toogleSwitch:) forControlEvents:UIControlEventValueChanged];
NSString * key = [[sets objectAtIndex:[indexPath section]] objectForKey:SOME_KEY];
uis.on = [[[NSUserDefaults standardUserDefaults] valueForKey:key] boolValue];
uis.tag = [indexPath section];
cell.accessoryView = uis;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment