title: how to fix an issue with custom subclass of uitableviewcell reuse?
body: <p>Before I get crucified for this, let me state... Yes, I have read every "relevant" answer on this topic and have not found a workable solution. Most "correct" answers are pre-ARC and discuss "releasing" a cell, which just isn't done anymore. Secondly, my problem is not "global", meaning some views have no problems, while others do. So here is my question...</p>
  
  <p>I have sub-classed uitableviewcell and setup some uilabels &amp; custom uiviews. From there I wired everything up in ib (Xcode 5.x iOS 7.x). Once I put in the appropriate code and create the tableview &amp; dynamic cells from a nsarray "not mutable" everything works exactly as expected with no issues. </p>
  
  <p>This is the fun part. I am making changes to allow the data source of the tableview, which is an nsarray to be mutable to allow adding and removing of items / cells. This is where things get hairy. When I start to add more objects to the array and when the reuse cell is being put on screen visual data from old cells is being reused on new cells. I say "visual" because once the cell is selected the view updates to display the correct information. The part that is interesting is that as I stated I have some uilabels which never have any problems being redisplayed, my custom views however are now the piece of the puzzle that is displaying info from past cells, and when scrolling back up, the original cells no longer display the correct information. Once the cell is tapped, then the cell updates and displays the correct information.</p>
  
  <p>the most confusing bit of this is that before my array was mutable and had a static amount of objects this worked fine. Even if a cell went off screen and came back, it was still the correct information being displayed. Now I know that shouldn't have anything to do with it, but it is strange that it worked using the same tableview &amp; cell code that I am using now. </p>
  
  <p>I have tried adding in </p>
  
  <pre><code>MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
  
  if (!cell) {
       cell = [[MyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; // note: obviously as stated, tacking on "autorelease" here as mention in other suggestions is not going to work.
  }
  </code></pre>
  
  <p>Which doesn't fix the issue.</p>
  
  <p>I tried overriding the "prepareForReuse" method on my custom cell subclass and that does not resolve the issue either. I have made the views, "strong" &amp; "weak", and all that and still every 3rd or so cell gets repeated with garbage data until it is refreshed. Again, the uilabels which are setup the same way as the views have no problems and data is never reused. I would say there is a problem with my custom views, but setting up the table from a static source of identical information there is no problem. </p>
  
  <p>I would like to post some code, but it's all pretty generic code for tableviews &amp; delegates. any suggestions would be greatly appreciated.  </p>
  
  <p>As i said the code is all pretty generic, but apparently it needs posing anyway so here it is..</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      MyThing *thing = self.stuffArray[indexPath.row];
  
      MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
  
      cell.thisLabel.text = thing.someText;
      cell.thatLabel.text = thing.otherText;
  
      cell.view1.someProptery = thing.object1.property
      cell.view2.someProptery = thing.object2.property
      cell.view3.someProptery = thing.object3.property 
      //"someProperty" on "view..." is an NSInt that is used to determine custom drawing in the view.
  
      return cell;
  }
  </code></pre>