update cells

This commit is contained in:
Pfeil, Scott Robert 2020-04-22 15:10:41 -04:00
parent ca389567cc
commit 8f4e7f82c3
2 changed files with 14 additions and 7 deletions

View File

@ -67,6 +67,11 @@ open class ProgrammaticTableViewController: ProgrammaticScrollViewController, UI
tableView.sectionFooterHeight = CGFloat.leastNormalMagnitude
}
open func refreshTable() {
tableView.beginUpdates()
tableView.endUpdates()
}
/// For subclassing, returns the number of sections for table. This function calls numberOfSectionsForTableview aftre ensuring the table is setup properly.
open func getNumberOfSections() -> Int {
return 1

View File

@ -15,7 +15,6 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
private var bottomView: UIView?
private var headerView: UIView?
private var footerView: UIView?
var useMargins: Bool = true
public var bottomViewOutsideOfScrollArea: Bool = false
public var topViewOutsideOfScrollArea: Bool = false
private var topViewBottomConstraint: NSLayoutConstraint?
@ -113,6 +112,9 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
bottomViewTopConstraint?.constant = newSpace
showFooter(width)
}
DispatchQueue.main.async {
self.refreshTable()
}
}
super.updateViewConstraints()
}
@ -162,10 +164,10 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
func showHeader(_ sizingWidth: CGFloat?) {
headerView?.removeFromSuperview()
tableView?.tableHeaderView = nil
guard let topView = topView,
let headerView = headerView else { return }
guard let headerView = headerView else { return }
if topViewOutsideOfScrollArea {
if topViewOutsideOfScrollArea,
let topView = topView {
// put top view outside of scrolling area.
topConstraint?.isActive = false
view.addSubview(topView)
@ -189,14 +191,14 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
/// Takes the current footerView and adds it to the tableFooterView
func showFooter(_ sizingWidth: CGFloat?) {
footerView?.removeFromSuperview()
guard let bottomView = bottomView,
let footerView = footerView,
guard let footerView = footerView,
let tableView = tableView else {
self.tableView?.tableFooterView = nil
return
}
if bottomViewOutsideOfScrollArea {
if bottomViewOutsideOfScrollArea,
let bottomView = bottomView {
// put bottom view outside of scrolling area.
bottomConstraint?.isActive = false
view.addSubview(bottomView)