1

こんにちは、UILabel フィールドで sizetofit を使用しています。tableview コントローラーをロードすると正常に動作しますが、上下にスクロールすると文字の切り取りと別の行への折り返しが開始されます。CellForRowAtIndexPath で使用するコードは次のとおりです。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"subjectCell" forIndexPath:indexPath];

    // Configure the cell...

    // Load and display subject photo image
    UIImageView *subjectImageView = (UIImageView *)[cell viewWithTag:200];
    subjectImageView.image = [UIImage imageNamed:subjectImages[indexPath.row]];


    // Load and display subject label
    UILabel *subjectLabel = (UILabel *)[cell viewWithTag:201];
    subjectLabel.text = [subjectItems objectAtIndex:indexPath.row];
    [subjectLabel sizeToFit];// call this to fit size of the label according to text



    return cell;
}

そして、ここに最初にロードされた私のテーブルビューコントローラーのスクリーンショットがあります:

ここに画像の説明を入力

ここで上下にスクロールすると、説明がカットされていることがわかります

ここに画像の説明を入力

これを解決するためにあなたが与えることができる助けをありがとう。

乾杯

カーソン

4

1 に答える 1