forkingdog / forkingdog/UITableView-FDTemplateLayoutCell

Archive

Open
#408 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
9.9k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

cache the height to model, may is anythings you want

```
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdForMessage(msg:array[safe: indexPath.row]), for: indexPath)

if let model = array[safe: indexPath.row] {
cell.reloadData(data: model as Any)
if (model.cellHeigth > CGFloat(0)) == false {
let size = cell.contentView.systemLayoutSizeFitting(CGSize(width: YYScreenSize().width, height: 0), withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel)
model.cellHeigth = size.height
}
}

return cell;
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the UITableView cellForRow implementation shown in the issue and inspect how the model's cellHeigth value is populated and reused. Confirm how the cell's systemLayoutSizeFitting result should be retained in the model; done means repeated layout can use the cached height without recalculating it.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, swift
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.