title: objective-c: [self.tableview reloadData] reloads data but doesnt clear older cells
body: <p>i'm working on a tableview and i am newbie in dynamically creating cells (i used to create them with IB and then link them to their tableviewcell controller etc..). </p>
  
  <p>Everything works great and recpected arrays are updated properly but when i fire [self.tableview reloadData] the program just redraws new values over old cells. for example if there "TEST CELL" value in a uilabel inside a cell, when i update the data to "CELL TEST" and fire the reloadData, the uilabel looks like there are two labels on top of each other and both values are visible. (its like creating two uilabel with exact same location and same size and setting their values)</p>
  
  <p>and this event happens everytime i fire reloadData, with each reload, the program looks like its adding another uilabel on top of the older one. heres my code: </p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
  static NSString *CellIdentifier = @"Cell";
  
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
      cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  }
  UILabel *lblText1 = [[UILabel alloc] initWithFrame:CGRectMake(30, 5, 130, 30)];
  lblText1.adjustsFontSizeToFitWidth = YES;
  lblText1.backgroundColor = [UIColor clearColor];
  lblText1.text = [lblText1Array objectAtIndex:indexPath.row];
  [cell addSubview:lblText1];
  [lblText1 release];
  if(indexPath.row&lt;3)
  {   
      UILabel *lblText2 = [[UILabel alloc] initWithFrame:CGRectMake(170, 5, 130, 30)];
      lblText2.adjustsFontSizeToFitWidth = YES;
      lblText2.backgroundColor = [UIColor clearColor];
      lblText2.text = nil;
      lblText2.text = [spParameters objectAtIndex:indexPath.row];
      [cell addSubview:lblText2];
      [lblText2 release];
  }
  else if(indexPath.row==3){
      UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(170, 7, 130, 30)];
      textField.adjustsFontSizeToFitWidth = YES;
      textField.borderStyle = UITextBorderStyleRoundedRect;
      textField.placeholder = @"please insert value";
      textField.textAlignment = UITextAlignmentCenter;
      textField.delegate = self;
      textField.text = [spParameters objectAtIndex:indexPath.row];
      [cell addSubview:textField];
      [textField release];
  }
  else if(indexPath.row == 4)
  {
      UISwitch *gSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(170, 7, 130, 30)];
      [gSwitch setOn:FALSE];
      [gSwitch addTarget: self action: @selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
      [cell addSubview:gSwitch];
      [gSwitch release];
  }
  // Configure the cell...
  return cell;
  </code></pre>
  
  <p>}</p>
  
  <p>im  releasing the components after i adding them to subviews, and i am thinking about if theres something wrong with the reuseidentifier... </p>
  
  <p>Thanx for helping. </p>