title: Custom UITableCellVew when there is a referencing outlet wired up in IB
body: <p>I am trying to use custom UITableViewCells defined in IB where there are referencing outlets. I have successfully used the techniques shown in several places in stackoverflow to load and use UITableViewClass when there is no referencing outlet, like below.</p>
  
  <pre><code>NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:nil options:nil];
  </code></pre>
  
  <p>I have a separate file called "TheCellsClass.xib", which has a single UITableViewCell defined with a single UILable called Alabel, "IBOutlet UILabel *Alabel;". If I connect the label to ALabel then I get this error</p>
  
  <pre><code>Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[&lt;NSObject 0x681b360&gt; setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Alabel.'
  </code></pre>
  
  <p>After searching here and the web I understand that this is caused by the fact that "owner:nil" does not define a class with this object:Alabel. I cannot use "owner:self" because that is the UITableViewController, and also does not define "Alabel".</p>
  
  <p>I created a class called "TheCellsClass" as a sub class of "UITableViewCell" that does define Alabel, see below;</p>
  
  <p>Then used:</p>
  
  <pre><code>        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:cell options:nil];
  </code></pre>
  
  <p>I still get the same error.  So, can anyone point out the error of my ways? :-)
  I only way I can think to fix this is to remove all referencing outlets and connect
   them using code</p>
  
  <p>Subclass header :</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  @interface TheCellsClass : UITableViewCell {   
      IBOutlet UILabel *Alabel;    
  }
  @property (strong, nonatomic) UILabel *Alabel;
  @end
  </code></pre>
  
  <p>Subclass body:</p>
  
  <pre><code>#import "TheCellsClass.h"
  @implementation TheCellsClass
  @synthesize Alabel;
  @end
  </code></pre>
  
  <p>In the table view controller</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  </code></pre>
  
  <p>I am using:</p>
  
  <pre><code>TheCellsClass* cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
  if (cell == nil) {
      if (cell == nil) {
          NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:cell options:nil];
  </code></pre>
  
  <p>A zip of a sample project is here <a href="http://www.proaa.com/tryout.zip" rel="nofollow">http://www.proaa.com/tryout.zip</a></p>
  
  <p>Suggestions?  Requests for more info?</p>
  
  <p>Any help appreciated.
  Geoff</p>