Using NSUserDefaults for storing UISwitch state
I am trying to persist the UISwitch state in my settings view of my application. Basically it is a UITableView and contains a few switches to get the user preferences. The below code explains how the switches are constructed (only one switch construct is given below, others are also constructed the sameway). if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:SomeIdentifierB] autorelease]; if (syncStartupSwitch) { syncSwitch.on = YES; }else { syncSwitch.on = NO; } [syncSwitch addTarget:self action:@selector(syncAtStartup:) forControlEvents