title: How to display a view from a NSViewController?
body: <p>I'm new at objective-c so please bear with me. I have a class that returns a picture from a webcam and I am trying to display that to the screen. I subclassed <code>NSViewController</code> to get the image from the camera class and set it to an instance <code>NSImageView</code> and set the <code>NSViewController</code>'s view to be the <code>NSImageView</code>. I have created a custom view in Interface Builder, dragged a NSViewController object into MainMenu.xib set it's class to be PhotoGrabberController, and control click-dragged from the custom view to the PhotoGrabberController to set it's outlet binding to be the view. (I really don't know how that works behind the scenes, it seems like magic to me). Nothing shows up on the screen and I've been playing around with this forever.</p>
  
  <p>In PhotoGrabberController.h</p>
  
  <pre><code>@interface PhotoGrabberController : NSViewController {
      PhotoGrabber * grabber;
      NSImageView* iView;
  }
  @property (nonatomic, retain) NSImageView* iView;
  </code></pre>
  
  <p>In PhotoGrabberController.m</p>
  
  <pre><code>@implementation PhotoGrabberController
  @synthesize iView,grabber;
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
  
      }
      return self;
  }
  
  - (void) awakeFromNib
  {
      self = [super init];
      if (self) {
          NSRect rect = NSMakeRect(10, 10, 200, 100);
          iView = [[NSImageView alloc] initWithFrame:rect];
          [iView setImageScaling:NSScaleToFit];
          [iView setImage:[NSImage imageNamed:@"picture.png"]];
          grabber = [[PhotoGrabber alloc] init]; 
          grabber.delegate = (id)self;
          //[grabber grabPhoto]; (This usually sets iView but I removed it and manually set iView to be an image from file above for simplicity)
          [self setView:iView];
      }
  }
  </code></pre>
  
  <p>I toyed around with putting a bunch of different things in the AppDelegate's <code>applicationDidFinishLaunching</code> but the way it's set up right now I think I shouldn't need to put anything in there.</p>
  
  <h2>Question</h2>
  
  <ol>
  <li>How do I get the main window to show the image?</li>
  <li>Is it ok to use PhotoGrabberController.view instead of creating a view subclass?</li>
  <li>What is wrong with my understanding of how things work here? I've spent a lot of time trying to figure this out and have gotten nowhere. </li>
  <li>Can you direct me to a resource where I can fully understand how this works? I've found Apple documentation too detailed and thick. I just want to understand how windows, views, and view controllers are loaded and interact.</li>
  </ol>