title: Using my own Cell object in XCODE
body: <p>I have successfully created my on "cell" object (based on UITableViewCell) and have successfully used it while building a table via <strong>cellForRowAtIndexPath</strong>.</p>
  
  <p>However, how do I deconstruct what I have done within <strong>didSelectRowAtIndexPath</strong>?</p>
  
  <p>I currently receive the error <strong>"Incompatible pointer types initializing 'MyCell *__strong' with an expression of type 'UITableViewCell'"</strong></p>
  
  <p>Given my object (MyCell) is based on UITableViewCell I don't understand why I am getting this error.</p>
  
  <p>Can you please help me understand what I am doing wrong.</p>
  
  <p>My alternative is to use a "TAG" for each of the two labels in the cell and get them that way, but I am just experimenting here trying to learn more about how this all works.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"myCellID";
      MyCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  
      if (cell == nil) {
          cell = [[MyCell alloc]
                  initWithStyle:UITableViewCellStyleDefault
                  reuseIdentifier:CellIdentifier];
      }
  
  cell.accountCode.text = @"0009810";
  cell.accountName.text = @"Agent Name";
  
  return cell;
  }
  </code></pre>
  
  <p>Here is the other method. I get the error on <strong>MyCell *cell = [tableView cellForRowAtIndexPath:indexPath];</strong></p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  
  // Get the cell that was selected
  MyCell *cell = [tableView cellForRowAtIndexPath:indexPath];
  
  AccountRecord *accountRecord = [[AccountRecord alloc] init];
  accountRecord.accountCode = cell.accountCode.text;
  accountRecord.accountName = cell.accountName.text;
  
  [self performSegueWithIdentifier:@"AccountDetail" sender:accountRecord];
  
  }
  </code></pre>
  
  <p>And here is MyCell</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface MyCell : UITableViewCell
  
  @property (nonatomic,strong) IBOutlet UILabel *accountCode;
  @property (nonatomic,strong) IBOutlet UILabel *accountName;
  
  @end
  </code></pre>
  
  <p>Any help would be appreciated.</p>