I have added a custom UILabel to the contentView of my cell, depending on the state of the app, it turns bold or regular weight. For some reason when I do [tableView reloadData] to make it regular weight again, the bold version of the label remains visible, like this:
See the pesky bit from the bold "7" still visible? It's like that for every cell, if it turns bold once, the "ghost" remains until the app quits.
The label is created this way:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//.....
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
label.text = @"my text here";
label.font = condition ? [UIFont boldSystemFontOfSize:12] : [UIFont systemFontOfSize:12];
label.numberOfLines = 1;
[label sizeToFit];
[cell.contentView addSubview:label];
[label release];
//......
}
This did not happen when I used the cell's textLabel, but for other reasons I need to use a separate UILabel.
What could be causing these views to stay after reloading data?