title: How to add custom NSView to Window
body: <p>I know how to do this in iOS but cannot figure it how to it in Cocoa.</p>
  
  <p>I want to capture keyboard events and I think I need to override the acceptsFirstResponder method to accomplish that (keyDown method being triggered). So I created a class extending NSCustomView and tried to add it in the main Window but I just cannot understand how to do it. So far I added a Custom View to the main View then tried to add it programmatically like:</p>
  
  <pre><code>TestView *view = [[TestView alloc] init];
  [[_window contentView] addSubview:view];
  </code></pre>
  
  <p>but this is not working. So how can I do this?</p>