I have this simple code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
}
// Configure the cell...
NSString *subtitle = [NSString stringWithString: @"All about the color "];
cell.detailTextLabel.text=subtitle;
cell.textLabel.text = [authorList objectAtIndex: [indexPath row]];
return cell;
}
The problem is that my subtitle doesn't appear.What am i doing wrong.Please help.Thanks.
You'll have to choose another cell style, look at the documentation:
UITableViewCellStyleDefault
A simple style for a cell with a text label (black and left-aligned) and an optional image view. Note that this is the default style for cells prior to iOS 3.0.
What you want, I think, is:
UITableViewCellStyleSubtitle
A style for a cell with a left-aligned label across the top and a left-aligned label below it in smaller gray text. The iPod application uses cells in this style.
You can refer to the Table View Programming Guide for iOS chapter Table View Styles and Accessory Views to see an overview of the styles and what they look like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With