Reputation: 10519
Using the following code I am getting the text.label but not the detailTextLabel.text. The NSLog is displaying correctly.
cell.textLabel.text = [eventLabels objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [eventFields objectAtIndex:indexPath.row]];
NSLog(@"%@", [eventFields objectAtIndex:indexPath.row]);
I also tried...
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", [eventFields objectAtIndex:indexPath.row]];
I have not had problems with this before. Any suggestions?
John
Upvotes: 33
Views: 27922
Reputation: 433
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];
}
Do remember to change to UITableViewCellStyleSubtitle
Upvotes: 24
Reputation: 4209
If you choose style UITableViewCellStyleSubtitle
, your detailTextLabel.text
will show
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] ;
Upvotes: 2
Reputation: 12003
Make sure you're using an appropriate UITableViewCellStyle
with this (anything but UITableViewCellStyleDefault
should thus work). The cell's style is specified when you initialize it.
Upvotes: 84