title: refresh cells in custom tableView
body: <p>I have a tableView and  a detailView where the user can change the data. It worked perfectly until I programmatically changed the cells from subtitle to custom. Now when I edit the data and I go back I see the new data overlapping the old one,this despite of the [self.tableView reloadData] in viewDidLoad.The data change is working well because if I relaunch the app the new data is displayed.</p>
  
  <p>Also the separator lines between the cells are not covering the whole width.</p>
  
  <p>Just to be sure here is the code for the custom cells:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  static NSString *CellIdentifier = @"Cell";
  
  UILabel *mainLabel, *detailLabel, *secondLabel;
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
  
  if (!cell)
  {
       cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  }
  
  mainLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 5.0, 220.0, 15.0)];
  // mainLabel.tag = MAINLABEL_TAG;
  mainLabel.font = [UIFont systemFontOfSize:14.0];
  mainLabel.textAlignment = NSTextAlignmentLeft;
  mainLabel.textColor = [UIColor blackColor];
  mainLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |    UIViewAutoresizingFlexibleHeight;
  [cell.contentView addSubview:mainLabel];
  
  secondLabel = [[UILabel alloc] initWithFrame:CGRectMake(100.0, 5.0, 200, 15.0)];
  // secondLabel.tag = MAINLABEL_TAG;
  secondLabel.font = [UIFont systemFontOfSize:10.0];
  secondLabel.textAlignment = NSTextAlignmentRight;
  secondLabel.textColor = [UIColor whiteColor];
  secondLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |    UIViewAutoresizingFlexibleHeight;
  [cell.contentView addSubview:secondLabel];
  
  detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 20.0, 220.0, 25.0)];
  // detailLabel.tag = SECONDLABEL_TAG;
  detailLabel.font = [UIFont systemFontOfSize:12.0];
  detailLabel.textAlignment = NSTextAlignmentLeft;
  detailLabel.textColor = [UIColor lightGrayColor];
  detailLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |        UIViewAutoresizingFlexibleHeight;
  [cell.contentView addSubview:detailLabel];
  
  
  SNMGps *aCell = [arrayOfCell objectAtIndex:indexPath.row];
  mainLabel.text = [NSString stringWithFormat:@"%@", aCell.name];
  secondLabel.text = [NSString stringWithFormat:@"%d",aCell.gpsID];
  detailLabel.text =  [NSString stringWithFormat:@"%@",aCell.notes];
  return cell;
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks.</p>