5

私は少しイライラしています。セルを含むiOS 10 プロジェクトUITableViewがあります。UITableViewAutomaticDimension制約を適切に設定します。

最初は、セルを内部にマッピングしていました

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

すべてが正常に機能していましたが、記事を読みました: https://medium.com/ios-os-x-development/perfect-smooth-scrolling-in-uitableviews-fd609d5275a5#.4rnbc4vygデータマッピングを

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)

この後、自動レイアウトセルが正しく機能しなくなりました。

cellForRowAtat height は after but beforeを計算していることを理解しているため、高さでwillDisplayマッピングしているときはwillDisplay、セルに既に設定されており、再度リロードする必要があります (これは良くありません)。

誰でもこれを証明/説明できますか?

アップデート:

質問を投稿した後、次の記事を見つけました: https://tech.zalando.com/blog/proper-use-of-cellforrowatindexpath-and-willdisplaycell/

4

1 に答える 1