1

如何在我的字幕中添加文本?目前我有一个带有名称列表的 NSArray,如何为名称添加字幕?

   lodgeList = [[NSArray alloc]initWithObjects:

            @"Abingdon Lodge No. 48",
            @"York Lodge No. 12",
            @"Alberene Lodge No. 277",

             nil];

继续...

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

 if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}


cell.textLabel.text =[lodgeList objectAtIndex:indexPath.row];

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

return cell;
4

1 回答 1

2

假设您使用的是标准 UITableViewCell,请确保将表格单元格的样式设置为UITableViewCellStyleSubtitle,然后通过设置单元格的detailTextLabel.text属性来设置字幕文本。

于 2012-09-04T21:57:17.067 回答