2

我遇到了这个问题,我的自定义表格视图单元格在以分组样式显示时没有缩进其内容。

static NSString *CellIdentifier = @"GameListCell";
    GameViewCell *cell = (GameViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"GameViewCell" owner:self options:nil];
        for (UIView *view in views)
        {
            if ([view isKindOfClass:[GameViewCell class]])
            {
                cell = (GameViewCell *)view;
            }
        }
    }
    Board *game = (Board *)[boardArray objectAtIndex:indexPath.row];
    cell.opponentName.text = [NSString stringWithFormat:@"Game vs %@",game.opponentName];
    cell.gameDescription.text = [NSString stringWithFormat:@"Last Move: %@",game.opponentName];
    return cell;

有谁知道可能发生了什么?

我还不能发布图片,但基本上内容太左了,超出了单元格的圆角矩形。

我认为它可能与表格视图单元格的 XIB 文件中的水平空间约束有关。它的值为“常量”和“20”。但是如何让内容显示在单元格的内容视图中?

它在“普通”样式中看起来不错,但对于分组样式没有缩进。

谢谢!

4

0 回答 0