Set estimated row height for tableview cells

This commit is contained in:
Maurice Parker 2019-10-28 17:18:44 -05:00
parent 456abc965f
commit 29efea3d00
1 changed files with 13 additions and 0 deletions

View File

@ -59,6 +59,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
refreshControl = UIRefreshControl()
refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged)
resetEstimatedRowHeight()
configureToolbar()
becomeFirstResponder()
}
@ -128,6 +129,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
}
@objc func contentSizeCategoryDidChange(_ note: Notification) {
resetEstimatedRowHeight()
applyChanges(animate: false)
}
@ -599,6 +601,17 @@ private extension MasterFeedViewController {
return cell
})
}
func resetEstimatedRowHeight() {
let titleLabel = NonIntrinsicLabel()
titleLabel.text = "But I must explain"
let unreadCountView = MasterFeedUnreadCountView()
unreadCountView.unreadCount = 10
let layout = MasterFeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false)
tableView.estimatedRowHeight = layout.height
}
func configure(_ cell: MasterFeedTableViewCell, _ node: Node) {