title: iOS 7 UITableView indexpath row property is nil
body: <p>I have a <code>UITableView</code> and it contains a custom <code>UITableViewCell</code>. To test, I have an array that has three strings in it. The <code>UITableView</code> delegate methods are called as expected, however, the <strong>tableView:cellForRowAtIndexPath</strong> delegate is always passed an <code>NSIndexPath</code> instance whose row property is always <code>== nil</code>:</p>
  
  <p><code>tableView:cellForRowAtIndexPath</code> is called 3 times (once for each object in my array). I added the <code>tableView</code> from within the designer (storyboard) and created an outlet for it. The UITableViewCell instances appear to be correctly instantiated which each call to this delegate. I just can't wrap my head around why the <code>[indexPath row]</code> value is always <code>nil</code>.</p>
  
  <p>Interface(s):</p>
  
  <p>In the implmentation file:</p>
  
  <pre><code>@interface FirstViewController ()
  @property(nonatomic, strong)AppDelegate *sharedDelegate;
  @property(nonatomic, strong)NSArray *userList;
  @end
  </code></pre>
  
  <p>In the header:</p>
  
  <pre><code>@interface FirstViewController : UITableViewController &lt;FacebookDelegate&gt;
  @property (strong, nonatomic) IBOutlet UITableView *tableView;
  @end
  </code></pre>
  
  <p>Init the custom cell:</p>
  
  <pre><code>-(void)viewDidLoad
  {
      [self.tableView registerClass: [ListCategoryCell class]forCellReuseIdentifier:@"ListCategoryCell"];
      self.userList = @[@"d", @"g", @"f"]; // make some test data
  }
  </code></pre>
  
  <p>And the delegate this is driving me mad:</p>
  
  <pre><code>//NSIndexPath.row is nil ?!
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
  {
      static NSString *MyIdentifier = @"ListCategoryCell";
      ListCategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier forIndexPath:indexPath];
      if (cell == nil) {
          cell = (ListCategoryCell *)[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:MyIdentifier];
      }
      cell.titleLabel.text = [self.userList objectAtIndex:[indexPath row]];
      cell.detailLabel.text = @"Detail";
  
      return cell;
  }
  </code></pre>
  
  <p>Am I missing something? Thanks!</p>
  
  <p><strong>Working Now</strong></p>
  
  <p>I left out some context (and I should not have) that I believe was very relevant to my problem. I created a UIViewController originally and then added a UITableView to this as the view. In the UITableView I created a custom prototype cell. I did all the house work: </p>
  
  <p><code>UIViewController</code> implemented the <code>UITableViewDelegate</code> &amp; <code>UITableViewDatasource</code>.
  Created and outlet for the <code>UITableView</code>.
  Hooked up all the outlets</p>
  
  <p>Everything seemed to work except for the fact that <code>indextPath.row</code> property was always <code>nil</code>. Some resources I found suggested that custom cells were not visible before the uitableview delegates were called. </p>
  
  <p>In the end I made my class a subclass of <code>UITableViewController</code>. Things started working. I am still curious why my original attempt was failing. </p>
  
  <p>Thanks for everyone's time. Some great comments helped me investigate some topics that are "good to know".   </p>