mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Update the timeline to correctly fix it to the bottom in UI tests. (#553)
This commit is contained in:
@@ -162,6 +162,13 @@ class TimelineTableViewController: UIViewController {
|
|||||||
hasAppearedOnce = true
|
hasAppearedOnce = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func didMove(toParent parent: UIViewController?) {
|
||||||
|
super.didMove(toParent: parent)
|
||||||
|
|
||||||
|
// Ensure the padding is correct before display.
|
||||||
|
updateTopPadding()
|
||||||
|
}
|
||||||
|
|
||||||
override func viewWillLayoutSubviews() {
|
override func viewWillLayoutSubviews() {
|
||||||
super.viewWillLayoutSubviews()
|
super.viewWillLayoutSubviews()
|
||||||
|
|
||||||
@@ -286,11 +293,14 @@ class TimelineTableViewController: UIViewController {
|
|||||||
/// Updates the additional padding added to the top of the table (via a header)
|
/// Updates the additional padding added to the top of the table (via a header)
|
||||||
/// in order to fill the timeline from the bottom of the view upwards.
|
/// in order to fill the timeline from the bottom of the view upwards.
|
||||||
private func updateTopPadding() {
|
private func updateTopPadding() {
|
||||||
let contentHeight = tableView.contentSize.height - (tableView.tableHeaderView?.frame.height ?? 0)
|
let headerHeight = tableView.tableHeaderView?.frame.height ?? 0
|
||||||
let height = tableView.visibleSize.height - contentHeight
|
let contentHeight = tableView.contentSize.height - headerHeight
|
||||||
|
let newHeight = max(0, tableView.visibleSize.height - contentHeight)
|
||||||
|
|
||||||
if height > 0 {
|
guard newHeight != headerHeight else { return }
|
||||||
let frame = CGRect(origin: .zero, size: CGSize(width: tableView.contentSize.width, height: height))
|
|
||||||
|
if newHeight > 0 {
|
||||||
|
let frame = CGRect(origin: .zero, size: CGSize(width: tableView.contentSize.width, height: newHeight))
|
||||||
tableView.tableHeaderView = UIView(frame: frame) // Updating an existing view's height doesn't move the cells.
|
tableView.tableHeaderView = UIView(frame: frame) // Updating an existing view's height doesn't move the cells.
|
||||||
} else {
|
} else {
|
||||||
tableView.tableHeaderView = nil
|
tableView.tableHeaderView = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user