update cells
This commit is contained in:
parent
ca389567cc
commit
8f4e7f82c3
@ -67,6 +67,11 @@ open class ProgrammaticTableViewController: ProgrammaticScrollViewController, UI
|
|||||||
tableView.sectionFooterHeight = CGFloat.leastNormalMagnitude
|
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.
|
/// For subclassing, returns the number of sections for table. This function calls numberOfSectionsForTableview aftre ensuring the table is setup properly.
|
||||||
open func getNumberOfSections() -> Int {
|
open func getNumberOfSections() -> Int {
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@ -15,7 +15,6 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
|
|||||||
private var bottomView: UIView?
|
private var bottomView: UIView?
|
||||||
private var headerView: UIView?
|
private var headerView: UIView?
|
||||||
private var footerView: UIView?
|
private var footerView: UIView?
|
||||||
var useMargins: Bool = true
|
|
||||||
public var bottomViewOutsideOfScrollArea: Bool = false
|
public var bottomViewOutsideOfScrollArea: Bool = false
|
||||||
public var topViewOutsideOfScrollArea: Bool = false
|
public var topViewOutsideOfScrollArea: Bool = false
|
||||||
private var topViewBottomConstraint: NSLayoutConstraint?
|
private var topViewBottomConstraint: NSLayoutConstraint?
|
||||||
@ -113,6 +112,9 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
|
|||||||
bottomViewTopConstraint?.constant = newSpace
|
bottomViewTopConstraint?.constant = newSpace
|
||||||
showFooter(width)
|
showFooter(width)
|
||||||
}
|
}
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.refreshTable()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.updateViewConstraints()
|
super.updateViewConstraints()
|
||||||
}
|
}
|
||||||
@ -162,10 +164,10 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
|
|||||||
func showHeader(_ sizingWidth: CGFloat?) {
|
func showHeader(_ sizingWidth: CGFloat?) {
|
||||||
headerView?.removeFromSuperview()
|
headerView?.removeFromSuperview()
|
||||||
tableView?.tableHeaderView = nil
|
tableView?.tableHeaderView = nil
|
||||||
guard let topView = topView,
|
guard let headerView = headerView else { return }
|
||||||
let headerView = headerView else { return }
|
|
||||||
|
|
||||||
if topViewOutsideOfScrollArea {
|
if topViewOutsideOfScrollArea,
|
||||||
|
let topView = topView {
|
||||||
// put top view outside of scrolling area.
|
// put top view outside of scrolling area.
|
||||||
topConstraint?.isActive = false
|
topConstraint?.isActive = false
|
||||||
view.addSubview(topView)
|
view.addSubview(topView)
|
||||||
@ -189,14 +191,14 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
|
|||||||
/// Takes the current footerView and adds it to the tableFooterView
|
/// Takes the current footerView and adds it to the tableFooterView
|
||||||
func showFooter(_ sizingWidth: CGFloat?) {
|
func showFooter(_ sizingWidth: CGFloat?) {
|
||||||
footerView?.removeFromSuperview()
|
footerView?.removeFromSuperview()
|
||||||
guard let bottomView = bottomView,
|
guard let footerView = footerView,
|
||||||
let footerView = footerView,
|
|
||||||
let tableView = tableView else {
|
let tableView = tableView else {
|
||||||
self.tableView?.tableFooterView = nil
|
self.tableView?.tableFooterView = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if bottomViewOutsideOfScrollArea {
|
if bottomViewOutsideOfScrollArea,
|
||||||
|
let bottomView = bottomView {
|
||||||
// put bottom view outside of scrolling area.
|
// put bottom view outside of scrolling area.
|
||||||
bottomConstraint?.isActive = false
|
bottomConstraint?.isActive = false
|
||||||
view.addSubview(bottomView)
|
view.addSubview(bottomView)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user