Reputation: 129
I setup the cell style to subtile in the inspector but still no subtitles, just blank but the title is displayed here is the section in the view controller:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
UITableViewCell *cell = nil;
cell = [tableView dequeueReusableCellWithIdentifier:@"homeworkcell"];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"homeworkcell"];
}
cell.textLabel.text = [tabledata objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [tablesubtitles objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
//static NSString *CellIdentifier = @"Cell";
/* if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier];
}*/
// Configure the cell.
//-----------------------------------------START----------------------------Set image of cell----
cellImage = [UIImage imageNamed:@"checkboxblank.png"];
cell.imageView.image = cellImage;
//--------------------------------------------END---------------------------end set image of cell--
return cell;
}
Upvotes: 0
Views: 9343
Reputation: 1554
You need to use the UITableViewCellStyleSubtitle
when you create a new UITableViewCell
, not UITableViewCellStyleDefault
. UITableViewCellStyleDefault
only shows the textLabel
in the cell, not the detailTextLabel
.
See the "Cell Styles" section of the UITableViewCell reference and the "Standard Styles for Table View Cells" of the Table View Programming Guide.
Upvotes: 5