私は持っていますtableview
が、どのセルにも長いテキストが表示されていません。さらに奇妙なのは、彼らが停止する設定値ではないように見えることです。一部のセルは、切り取られる前に他のセルよりも多くのテキストを表示します。NSLog()
文字列が正しく設定されていることを確認します。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//code for getting string removed for readability
// Identifier for retrieving reusable cells.
static NSString *cellIdentifier = @"MyCellIdentifier";
// Attempt to request the reusable cell.
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
// No cell available - create one.
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
// format it
cell.textLabel.numberOfLines = 0;
cell.textLabel.font = [UIFont systemFontOfSize:12.0];
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
}
// Set the text of the cell to the row index.
cell.textLabel.text = fulltext;
return cell;
}
numberOfLines
関数 atがそれを処理するという印象を受けました0
が、すべてのセルが 2 行にあり、それ以上ではありません。必要な数の行に調整するにはどうすればよいですか? ありがとう。