title: Loading a Nib within a Nib
body: <p>I am new to interface builder and I would like to have a screen which contains a 3x3 grid of a UIView each of which contain a UIImageView, and 4 UILabels.</p>
  
  <p>My logic is probably flawed but the way I am trying to achieve this was to: </p>
  
  <ol>
  <li>Create a UIView Nib file MyUIView.nib and layout in IB with an imageView and 4 labels</li>
  <li>Create a UIView subclass called MyUIView.m which contains 1 IBOutlet UIImageView and 4 IBOutlet UILabels. Link the MyUIView.nib and MyUIView.m as files owner and connect the outlets.</li>
  <li>Then create another nib MyGridViewController.nib which has 9 MyUIView in it laid out in the 3x3 grid.</li>
  <li>Create a UIViewController which has 9 IBOutlet MyUIView and connect them via Interface Builder.</li>
  </ol>
  
  <p>Is it possible to load a nib into another nib graphically from within InterfaceBuilder, if so how do I do it? Do I drag a "standard" UIView onto the canvas and then change the class to be a MyUIView?</p>
  
  <p>Or do I need to do this all programmatically within the MyGridViewController.m with something like:</p>
  
  <pre><code>for (int i=0; i&lt;9; i++)
  {
      NSArray* nibViews =  [[NSBundle mainBundle] loadNibNamed:@"MyUIView" owner:self options:nil];
     [myViewArray addObject:[ nibViews objectAtIndex: 1]];
  }
  </code></pre>
  
  <p>The only other way I have gotten this to work was to have a single Nib and put 9 UIImageViews and 36 UILabels but this obviously is a pain when I want to change something as I need to update each one of the 3x3 "cells". I thought it would be easier to change it in one file and all 9 would be updated.</p>