简体   繁体   English

我如何将第二行放在Objective-C的表格视图单元格中?

[英]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. 其中dataarray1是以下数组。

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? 您是否尝试过使用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 您正在寻找的样式是UITableViewCellStyleSubtitle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在objective-c中单击单元格时如何在其他视图中添加表视图单元格的内容 - how to add the content of the cell of table view in other view when clicked on cell in objective-c 在objective-c的表视图的每个单元格中获得相同的值 - getting the same value in each cell of table view in objective-c 如何从数组中的数据库中收集数据,然后将数据用于表视图的每一行 - how to collect the data from database in array and then put that data for each row of table view in objective-c 我可以在结构中放置一个Objective-C选择器吗? - can I put an objective-C selector in a struct? 如何在Objective-c中将UIView添加到表单元格? - How to add an UIView to a table cell in objective-c? 如何在if语句中放置#define-Objective-C - How to put a #define in an if statement - Objective-C 如何在父视图中调用方法? (iPhone / Objective-C) - How can I call a method in parent view? (iPhone/ Objective-C) 我可以在目标C中使用高亮显示的表格视图单元格而不使用默认蓝色吗? - can i use highlighted the table view cell without default blue color in objective c? 我如何在Objective-C中暂停/重新启动循环 - How can I pause/restart a loop in objective-c 如何为 iOS 应用程序创建 objective-C 框架 - How can I create objective-C Framework for iOS Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM