title: storing indexpath in a custom UITableViewCell
body: <p>So I'm trying to store a cell's indexpath when my custom cell is created in </p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  </code></pre>
  
  <p>I define a custom cell in class called "custom cell", and I added a property to that class defined as such: </p>
  
  <pre><code>@property (nonatomic, strong) NSIndexPath *indexPath;
  </code></pre>
  
  <p>in <code>cellForRowAtIndexPath</code> I set the index path with <code>customCell.indexPath = indexPath.</code></p>
  
  <p>When I <code>NSLog</code> it on the very next line it returns null. Could somebody please explain why this is happening?</p>
  
  <p><strong>Edit</strong> </p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
   static NSString *CellIdentifier = @"EditableCell";
  
  EditableCell *editableCell = (EditableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  
  if (editableCell == nil) {
  
      editableCell = [[EditableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  }
  
  _myTextField = [editableCell textFieldCell];
  
  if (indexPath.section == 0){
      [_myTextField setPlaceholder:@"text"];
      [_myTextField setReturnKeyType:UIReturnKeyNext];
  }
  else if (indexPath.section == 1){
      [_myTextField setPlaceholder:@"text"];
      [_myTextField setReturnKeyType:UIReturnKeyNext];
  }
  else {
      [_myTextField setPlaceholder:@"text"];
      [_myTextField setReturnKeyType:UIReturnKeyDone];
  }
  
  _myTextField.keyboardType = UIKeyboardTypeDefault;
  _myTextField.delegate = self;
  
  return editableCell;
  </code></pre>
  
  <p>}</p>
  
  <p>Where I call [self.tableview indexpathforcell:cell]</p>
  
  <pre><code>-(BOOL)textFieldShouldReturn:(UITextField *)textField{
  
  if (textField.returnKeyType == UIReturnKeyNext) {
  
      UITableViewCell* myCell = (UITableViewCell*)textField.superview;
      EditableCell *currentCell = (EditableCell *)myCell;
  
  
         NSLog(@"INDEXPATH OF CURRENT CELL: %@",[self.tableView indexPathForCell:currentCell]);   
  }     
  }
  </code></pre>