title: UISwitch displays strangely when it is turned off (Objective-C)
body: <p>The UISwitch displays strangely if the default value is on when the app is launched and I turn it off later. But it's normal the other way around. Why does it happen?</p>
  <p>It is programmatically created in Objective-C and written inside viewDidLoad. It's on an ordinary view (login page), not on a reusable cell or something.</p>
  <p><a href="https://i.stack.imgur.com/3S43a.png" rel="nofollow noreferrer">Please see the picture here</a></p>
  <pre><code>    saveUserSwitch = [[UISwitch alloc] initWithFrame:CGRectMake((saveUserLb.frame.origin.x + 140),saveUserLb.frame.origin.y + 10, 40, 30)];
      [self.view addSubview:saveUserSwitch];
  
      if ([username isEqualToString: @&quot;&quot;]) {
          self.saveUserSwitch.on = false;
          usernameFld.text = @&quot;&quot;;
      } else {
          self.saveUserSwitch.on = true;
          usernameFld.text = username;
      }
  </code></pre>