代码之家  ›  专栏  ›  技术社区  ›  sudo rm -rf

UITableViewCellStyleSubtitle未正确显示

  •  0
  • sudo rm -rf  · 技术社区  · 15 年前

    我试图将一些文本显示为 subtitle tableView .

    这是我的代码 :

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
    
        if (cell == nil)
        {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:SimpleTableIdentifier] autorelease]; } //did the subtitle style
    
            NSUInteger row = [indexPath row];
            cell.textLabel.text = [listData objectAtIndex:row];
            return cell;
    
            cell.detailTextLabel.text = @"Hello there";  //This is not displaying...
        }
    }
    

    我跑步时看不到字幕有什么原因吗?

    1 回复  |  直到 13 年前
        1
  •  19
  •   Atulkumar V. Jain    13 年前
    return cell;
    
    cell.detailTextLabel.text = @"Hello there";  //This is not displaying...
    

    你设置了 detailTextLabel 在你之后 return 返回

    推荐文章