title: Force NSView to redraw programmatically
body: <p>My app has two different states, and every state will be representing with a NSView.</p>
  
  <p>so there is only one view showed at a time, the problem is when I switched between the views the app doesn't show the new state until I resize the window manually!</p>
  
  <p>I searched about this problem and come with more than one solution but nothing worked with me:</p>
  
  <pre><code>[myView setNeedsDisplay:YES];
  [myView display];
  [[myView.window contentView] setNeedsDisplay:YES];
  
  
  [mySubView1 setHidden:YES]; || [mySubView1 removeFromSuperView];
  </code></pre>
  
  <p>I even defined myView as Outlet, and nothing work.</p>
  
  <p>and this is my code</p>
  
  <pre><code>if (appState == 1) {
  
      [self.splitView setFrameSize:CGSizeMake(self.splitView.frame.size.width, self.view.frame.size.height - 250)];
  
      [self.mySubView1 setHidden:NO];
      [self.mySubView2 setHidden:YES];
  
      [self.mySubView2 removeFromSuperview];
      [self.mySubView1 addSubview:self.inCallView];
  }
  else
  {
      [self.splitView setFrameSize:CGSizeMake(self.splitView.frame.size.width, self.view.frame.size.height - 70)];
  
      [self.mySubView1 setHidden:YES];
      [self.mySubView2 setHidden:NO];
  
      [self.mySubView1 removeFromSuperview];
      [self.mySubView2 addSubview:self.chatHeaderView];
  }
  // I need to redraw here
  [self.view setNeedsDisplay:YES];
  [self.mySubView1 setNeedsDisplay:YES];
  [self.mySubView2 setNeedsDisplay:YES];
  // and nothing happened until I resize my window manually 
  </code></pre>