Чтобы добавить UILabel в ячейку таблицы, я использую
UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(270, 10, 40, 12)];
timeLabel.text = @"2s";
timeLabel.backgroundColor = [UIColor clearColor];
timeLabel.font = [UIFont systemFontOfSize:12];
timeLabel.textColor = [UIColor lightGrayColor];
timeLabel.highlightedTextColor = [UIColor whiteColor];
timeLabel.textAlignment = UITextAlignmentRight;
timeLabel.frame = CGRectIntegral(timeLabel.frame);
[cell.contentView addSubview:timeLabel];
in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
.
Это отлично работает, пока я не прокручу таблицу или не выберу ячейку. Затем этикетка становится пиксельной.
При загрузке:
после действия:
Я также попытался добавить метку, создав подкласс UITableViewCell и загрузив его в - (void) layoutSubviews
.
Я уже нашел связанные вопросы здесь и здесь, но ничего работал.
РЕДАКТИРОВАТЬ: невозможно использовать стандартные метки ячеек, поскольку они уже используются. Мне нужно добавить дополнительный ярлык.