title: UIView subclass with its own XIB
body: <p>I created a custom UIView subclass, and would prefer to not layout the UI in code in the UIView subclass. I'd like to use a xib for that. So what I did is the following.</p>
  
  <p>I created a class "ShareView" which subclasses UIView. I created a XIB file with its file's owner set to "ShareView". Then I link some outlets I declared in my "ShareView.h".</p>
  
  <p>Next I have a ViewController, MainViewController, which adds the ShareView as a subview. whith this code: </p>
  
  <pre><code>NSArray *arr = [[NSBundle mainBundle] loadNibNamed:@"ShareView" owner:nil options:nil];
  UIView *fv = [[arr objectAtIndex:0] retain];
  fv.frame = CGRectMake(0, 0, 320, 407);
  [self.view addSubview:fv];
  </code></pre>
  
  <p>But now I get NSUnknownKeyException errors on the outlets I declared in my ShareView.</p>
  
  <p>The reason I did all this is because I want a UIView, with its own logic in a seperate XIB file. I read in several places that ViewControllers are only used to manage a full screen, i.e. not parts of a screen... 
  So what am I doing wrong? I want my logic for ShareView in a seperate class, so my MainController class doesn't get bloated with logic from ShareView (which I think is an aption to solve this problem?)</p>