gpt4 book ai didi

objective-c - UITableView 字幕没有出现

转载 作者:可可西里 更新时间:2023-11-01 05:01:02 28 4
gpt4 key购买 nike

我有这个简单的代码:

- (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;
}

问题是我的字幕没有出现。我做错了什么。请帮忙。谢谢。

最佳答案

您必须选择其他单元格样式,请查看文档:

UITableViewCellStyleDefault

A simplestyle for a cell with a text label(black and left-aligned) and anoptional image view. Note that this isthe default style for cells prior toiOS 3.0.

我想你想要的是:

UITableViewCellStyleSubtitle

A stylefor a cell with a left-aligned labelacross the top and a left-alignedlabel below it in smaller gray text.The iPod application uses cells inthis style.

您可以引用iOS Table View Programming Guide章节Table View Styles and Accessory Views查看样式及其外观的概述。

关于objective-c - UITableView 字幕没有出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5770293/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com