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 に答える