Когда я вызываю [table reloaddata];
Ячейки перерисовываются с новыми данными, но мои UILabels запутываются, потому что они рисуются поверх старых UILabels, поэтому это беспорядок.
static NSString* PlaceholderCellIdentifier = @"PlaceholderCell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:PlaceholderCellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:PlaceholderCellIdentifier] autorelease];
cell.detailTextLabel.textAlignment = UITextAlignmentCenter;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.contentView.backgroundColor = [UIColor clearColor];
}
Является ли я инициатором ячейки.
Я добавляю UILabel следующим образом:
UILabel *theDateLabel = [[UILabel alloc] initWithFrame:CGRectMake(140, 35,140, 20)];
[theDateLabel setBackgroundColor:[UIColor clearColor]];
[theDateLabel setTextColor:[UIColor lightGrayColor]];
[theDateLabel setText:[dateFormatter stringFromDate:theDate]];
[theDateLabel setFont:[UIFont fontWithName:@"TrebuchetMS-Bold" size:15]];
[cell addSubview:theDateLabel];
[theDateLabel release];
В ячейке есть еще несколько ярлыков, тоже самое.
Я бы хотел, чтобы старые ярлыки исчезли из ячейки, и они перестали быть видимыми.