Я не могу понять, как добавить текст в другой цвет в правую часть ячейки таблицы. Вот код, который я добавил.Добавить правильную деталь в ячейку для просмотра таблицы
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *informationTableIdentifier = @"InformationCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:informationTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:informationTableIdentifier];
}
[cell.textLabel setFont:[UIFont systemFontOfSize:15]];
[cell.textLabel setTextColor:[UIColor blackColor]];
if (indexPath.section == 0) {
cell.textLabel.text = [infoCellFirstSection objectAtIndex:indexPath.row];
}
if (indexPath.section == 1) {
if (indexPath.row == 3 || indexPath.row == 3) {
cell.detailTextLabel.text = @"@SykesHarvey";
[cell.detailTextLabel setTextColor:[UIColor colorWithRed:0.48 green:0.93 blue:0.25 alpha:1.0]];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:informationTableIdentifier];
}
cell.textLabel.text = [infoCellSecondSection objectAtIndex:indexPath.row];
}
if (indexPath.section == 2) {
if (indexPath.row == 2 || indexPath.row == 3) {
[cell.textLabel setFont:[UIFont systemFontOfSize:14]];
[cell.textLabel setTextColor:[UIColor grayColor]];
cell.textLabel.numberOfLines = 0;
cell.backgroundColor = [UIColor clearColor];
[cell setAccessoryType:UITableViewCellAccessoryNone];
}
cell.textLabel.text = [infoCellThirdSection objectAtIndex:indexPath.row];
}
if (indexPath.section == 3) {
cell.textLabel.text = [infoCellFourthSection objectAtIndex:indexPath.row];
}
if (indexPath.section == 4) {
cell.textLabel.text = [infoCellFifthSection objectAtIndex:indexPath.row];
}
return cell;
}
Все это представляет это , но я хочу сказать, @SykesHarvey на правой стороне ячейки для разработчиков. Пожалуйста, кто-нибудь может помочь?
Я не понимаю, что вы делаете: В вашем случае с вопросом, вы делаете сразу после того, вы пытались установить detailsText вы делаете целый новый Alloc/инициализации для ячейки? Обратите внимание: 'cell.detailsText' должен быть' nil', потому что нет 'detailsText' с' UITableViewCellStyleDefault' – Larme
Можете ли вы объяснить подробно? Именно в чем проблема? –