mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 00:01:00 +00:00
Ensure table view is laid out properly
This commit is contained in:
parent
d556d7986e
commit
9f350d1305
1 changed files with 18 additions and 14 deletions
|
@ -115,10 +115,6 @@ class TableViewController: UITableViewController {
|
|||
for loadMoreView in visibleLoadMoreViews {
|
||||
loadMoreView.directionChanged(up: up)
|
||||
}
|
||||
|
||||
if newItemsView.alpha > 0 {
|
||||
hideNewItemsView()
|
||||
}
|
||||
}
|
||||
|
||||
override func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
||||
|
@ -183,14 +179,6 @@ class TableViewController: UITableViewController {
|
|||
|
||||
sizeTableHeaderFooterViews()
|
||||
}
|
||||
|
||||
override func accessibilityScroll(_ direction: UIAccessibilityScrollDirection) -> Bool {
|
||||
if newItemsView.alpha > 0 {
|
||||
hideNewItemsView()
|
||||
}
|
||||
|
||||
return super.accessibilityScroll(direction)
|
||||
}
|
||||
}
|
||||
|
||||
extension TableViewController {
|
||||
|
@ -408,8 +396,20 @@ private extension TableViewController {
|
|||
.store(in: &cancellables)
|
||||
|
||||
tableView.publisher(for: \.contentOffset)
|
||||
.removeDuplicates()
|
||||
.handleEvents(receiveOutput: { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
|
||||
if (self.newItemsView.layer.animationKeys() ?? []).isEmpty, self.newItemsView.alpha > 0 {
|
||||
self.hideNewItemsView()
|
||||
}
|
||||
})
|
||||
.compactMap { [weak self] _ in self?.tableView.indexPathsForVisibleRows?.first }
|
||||
.sink { [weak self] in self?.viewModel.viewedAtTop(indexPath: $0) }
|
||||
.sink { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.viewModel.viewedAtTop(indexPath: $0)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
NotificationCenter.default.publisher(for: UIScene.willEnterForegroundNotification)
|
||||
|
@ -477,6 +477,8 @@ private extension TableViewController {
|
|||
} else if setPreviousOffset {
|
||||
self.tableView.contentOffset.y = preUpdateContentOffsetY
|
||||
}
|
||||
|
||||
self.tableView.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -799,7 +801,7 @@ private extension TableViewController {
|
|||
self.newItemsViewVisibleConstraint?.isActive = true
|
||||
self.view.layoutIfNeeded()
|
||||
} completion: { _ in
|
||||
|
||||
self.view.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -809,6 +811,8 @@ private extension TableViewController {
|
|||
self.newItemsViewHiddenConstraint?.isActive = true
|
||||
self.newItemsViewVisibleConstraint?.isActive = false
|
||||
self.view.layoutIfNeeded()
|
||||
} completion: { _ in
|
||||
self.view.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue