1
我有一个单元格的表格,其中字幕只出现在搜索到的东西后面。这是cellForRowAtIndexPath
代码:UITableViewCell字幕没有出现在加载
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
if(tableView == self.tableView)
{
// Configure the cell...
cell.textLabel.text = self.objects[indexPath.row];
cell.detailTextLabel.text = @"test2";
}
else{
// Configure the cell...
cell.textLabel.text = self.results[indexPath.row];
cell.detailTextLabel.text = @"test1";
}
return cell;
}
编辑:ArtOfWarfare的答案是正确的。这是故事板中的问题。见下图:
so ...''detailTextLabel.text'不显示任何东西,直到你搜索something.hm ...在搜索前怎么样'textLabel.text'? – staticVoidMan
它在那里,它看起来就像当我使用'UITableViewCellStyleDefault' –
也许这... http://stackoverflow.com/a/10500210/2857130 – staticVoidMan