title: Custom UITableViewCell Not Loading
body: <p>I am creating my own custom UITableViewCell using interface builder. I am supporting iOS 5 &amp; iOS 6 but I do not want to use Storyboard. Please do not suggest storyboard. I'm sticking to Interface Builder and writing programatically.</p>
  
  <p>I created a class that subclasses UITableViewCell. Here's the .h file:</p>
  
  <pre><code>@interface CategoryCell : UITableViewCell
  {
      __weak IBOutlet UIImageView *image;
      __weak IBOutlet UILabel *name;
      __weak IBOutlet UILabel *distance;
      __weak IBOutlet UILabel *number;
      __weak IBOutlet UIImageView *rating;
  }
  
  @property (nonatomic, weak) IBOutlet UIImageView *image;
  @property (nonatomic, weak) IBOutlet UILabel *name;
  @property (nonatomic, weak) IBOutlet UILabel *distance;
  @property (nonatomic, weak) IBOutlet UILabel *number;
  @property (nonatomic, weak) IBOutlet UIImageView *rating;
  
  @end
  </code></pre>
  
  <p>The XIB file is of type UIViewController and has a View of type CategoryCell. I connected the outlets as I have to.</p>
  
  <p><strong>The Problem</strong></p>
  
  <p><code>dequeueResuableCellWithIdentifier</code> is not calling the custom cell. Here's what I have:</p>
  
  <pre><code>    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
      {
          static NSString *cellIdentifier = @"CategoryCell";
          CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  
          if (cell == nil) {
  
              NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CategoryCell" owner:self options:nil];
              cell = [topLevelObjects objectAtIndex:0];
              .....
          }
          return cell
  }
  </code></pre>
  
  <p>When I substitute the <code>loadBundle</code> line with: <code>cell = [[CategoryCell alloc]  initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];</code>, it does work. But the nib does not load. So a cell loads, but not my own cell so I cannot set the labels and images that I want. When adding the regular load bundle line (as the sample above shows) and breakpoint the <code>init</code> method of the custom cell, it does not get called. Also, what I get is a full white screen that overrides the whole iPhone screen in the simulator.</p>
  
  <p>Why's that happening? What am I doing wrong here? When I tried setting the outlets to <code>strong</code> (which I know I'm not supposed to), it does not work either.</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>I fixed it by replacing the NSBundle line with:</p>
  
  <pre><code>UIViewController *temporaryController = [[UIViewController alloc] initWithNibName:@"CategoryCell" bundle:nil];
  cell = (CategoryCell *)temporaryController.view;
  </code></pre>
  
  <p>What is it that I've done wrong with the NSBundle method? Supposedly that's supposed to be the "easier" way to do it.</p>