title: iOS: setting default value for UISwitch
body: <p>I have some issue with default value for my switch. I added a FirstSwitchValue to UsersDefaults and this function works:</p>
  
  <pre><code>- (void)viewDidLoad
  {
   [super viewDidLoad];
  
   if ([[NSUserDefaults standardUserDefaults] boolForKey:@"FirstSwitchValue"]) {
     NSLog(@"Exists");
   }
   else {
     NSLog(@"Not Exists");
   }
  }
  </code></pre>
  
  <p>My switch looks like this:</p>
  
  <pre><code>- (IBAction)FirstSwitch:(id)sender {
  
   UISwitch *FirstSwitch = (UISwitch *)sender;
   // saving data
   if (FirstSwitch.on == YES) {
     [self setParamWithName:@"tag" withValue:@"1"];
   }
   else {
     [self setParamWithName:@"tag" withValue:@"0"];
   }
  }
  </code></pre>
  
  <p>If I add </p>
  
  <pre><code>[FirstSwitch setOn:YES animated:YES];
  </code></pre>
  
  <p>in <code>viewDidLoad</code> method I receive error message that I use undeclared identifier <code>FirstSwitch</code>. After adding declaration like this:</p>
  
  <pre><code>@property (weak, nonatomic) IBOutlet UISwitch *FirstSwitch;
  </code></pre>
  
  <p>my <code>FirstSwitch</code> stopped working. Can anyone help me?</p>