Это соответствующий код, который у меня есть:
Код: Выделить всё
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomTableCell *cell = (CustomTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CustomTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
TransactionList *tList = [_list objectAtIndex:indexPath.row];
/*
cell.transaction.text = tList.transaction;
cell.type.text = tList.type;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"ddMMYYYY"];
NSString *dateAsString = [formatter stringFromDate:tList.date];
cell.date.text = dateAsString;
*/
//this code below displays the contents just fine, but the block of code above does not.
cell.textLabel.text = tList.transaction;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@, %@", tList.type, tList.status];
return cell;
}
Код: Выделить всё
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.contentView.frame = CGRectMake(0, 0, 320, 80);
_transaction = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 80, 40)];
[_transaction setBackgroundColor:[UIColor clearColor]];
[_transaction setFont:[UIFont systemFontOfSize:12]];
[_transaction setNumberOfLines:2];
[_transaction setLineBreakMode:NO];
[self.contentView addSubview:_transaction];
_date = [[UILabel alloc] initWithFrame:CGRectMake(100, 5, 80, 40)];
[_date setBackgroundColor:[UIColor clearColor]];
[_date setFont:[UIFont systemFontOfSize:12]];
[_date setNumberOfLines:2];
[_date setLineBreakMode:NO];
[self.contentView addSubview:_date];
_type = [[UILabel alloc] initWithFrame:CGRectMake(200, 5, 80, 40)];
[_type setBackgroundColor:[UIColor clearColor]];
[_type setFont:[UIFont systemFontOfSize:12]];
[_type setNumberOfLines:2];
[_type setLineBreakMode:NO];
_type.lineBreakMode = NO;
[self.contentView addSubview:_type];
}
return self;
}

Я пробовал изменить стиль с «Базового» на «Пользовательский» на «Субтитры», но это не помогло. Он отображает только значения таблицы по умолчанию, и эти настройки меняют способ их отображения, но содержимое моего массива ни при каких обстоятельствах не отображается в таблице. Что я делаю не так?
Подробнее здесь: https://stackoverflow.com/questions/177 ... ell-in-ios