Я хочу иметь две данные в каждой строке в моем табличном представлении.Что-то вроде Recent Call (слева имя, справа день)
это мой код:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
//cell.selectionStyle = UITableViewCellStyleValue1 ;
}
// Configure the cell.
NSDictionary *dictionary = [listaOggetti objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"Elementi"];
NSString *cellValue = [array objectAtIndex:indexPath.row];
NSArray *array1 = [dictionary objectForKey:@"Tipo"];
NSString *cellDetail = [array1 objectAtIndex:indexPath.row];
if ([indexPath row] == 0){
cell.textLabel.text = cellValue;
cell.textAlignment = UITextAlignmentCenter;
cell.backgroundColor = [UIColor blueColor];
cell.font = [UIFont systemFontOfSize:13];
} else {
cell.textLabel.text = cellDetail;
cell.detailTextLabel.text = cellValue;
}
return cell;
}
я пытаюсь использовать другой стиль на
initWithStyle
безрезультатно (показывай только мой подробный текст справа).В NSLOG я вижу правильное значение cellDetail.
{
Elementi = (
"Chiamate e Videochiamate Nazionali",
"08m:43s",
"1h:31m:17s",
"1h:40m:00s"
);
},
{
Tipo = (
Effettuato,
Rimanente,
Totale
);
},
{
Elementi = (
"SMS e MMS Nazionali",
21,
29,
50
);
},
{
Tipo = (
Effettuato,
Rimanente,
Totale
);
},
{
Elementi = (
"Traffico Dati FMM",
"69.95 MB",
"954.05 MB",
"1024.00 MB"
);
},
{
Tipo = (
Effettuato,
Rimanente,
Totale
);
},
{
Elementi = (
Skype,
"00m:00s",
"3h:20m:00s",
"3h:20m:00s"
);
},
{
Tipo = (
Effettuato,
Rimanente,
Totale
);
},
{
Elementi = (
"WWW3, Yahoo!, Google, eBay e altri servizi",
"0.00 MB",
"100.00 MB",
"100.00 MB"
);
},
{
Tipo = (
Effettuato,
Rimanente,
Totale
);
}
)
Моя цель состоит в том, чтобы получить такие ячейки: