简体   繁体   中英

how can i put the second line in the table view cell in objective-c?

I am using the following code to add the next line in the same same but i am not getting the output.

cell.detailTextLabel.text= [self.dataArray1 objectAtIndex:indexPath.row];

where dataarray1 is the following array.

self.dataArray1 = [NSArray arrayWithObjects:@"sugar :   1 teaspoon", @"salt  :   1 teaspoon",@"sugar  :   1 teaspoon", @"salt  :   1 teaspoon",@"sugar  :   1 teaspoon", @"salt  :   1 teaspoon",@"sugar :   1 teaspoon", @"salt  :   1 teaspoon",nil];

how can i add the more content in the same cell of table view.

Have you tried using the UITableViewCellStyleSubtitle UITableViewCellStyle? I'm guessing that the style you're using might not support the detail text.

You have to set the style of the cell when you init it for it to show the detail text.

- (id)initWithStyle:(UITableViewCellStyle)stylereuseIdentifier:(NSString *)reuseIdentifier

the style you are looking for is UITableViewCellStyleSubtitle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM