title: How do I set a nested property if the object needs to be cast?
body: <p>In my method to set labels in my cells (for an UITableView) I'm reading in 'id' that's actually an UITableViewCell since I'm reading in several different types of cells. I.e.:</p>
  
  <pre><code>-(void)setMyCell:(id)cell atIndexPath:(NSIndexPath*)indexPath;
  </code></pre>
  
  <p>Some of the cells are of the generic UITableViewCellStyle type whilst others are more complicated and load a NIB etc. for the different sections.</p>
  
  <p>To access a UILabel text property for my custom cells I can do something like</p>
  
  <pre><code>[(CustomCell*) cell setMyTextLabel:@"text"];
  </code></pre>
  
  <p>and I can create a method in the CustomCell class to set the label text.</p>
  
  <p>For the generic cells the label is called 'textLabel'. I think I can do something like</p>
  
  <pre><code>[(UITableViewCell*) cell setTextLabel:&lt;new UILabel here&gt;];
  </code></pre>
  
  <p>but that seems somewhat messy as I need to create a new UILabel.</p>
  
  <p>I tried</p>
  
  <pre><code>(UITableViewCell*)cell.textLabel.text = @"text";
  </code></pre>
  
  <p>which would work if cell was of the class UITableViewCell, not id, but it doesn't in this case.</p>
  
  <p>So is there any way to just set textLabel.text without creating a new UILabel?</p>