Bug fixes
This commit is contained in:
parent
66a06d9815
commit
adaa9ca1f3
@ -28,6 +28,8 @@ import UIKit
|
||||
|
||||
private var heroAccessoryCenter: CGPoint?
|
||||
|
||||
private var initialSetupPerformed = false
|
||||
|
||||
// MARK: - Styling
|
||||
open func style(with styleString: String?) {
|
||||
guard let styleString = styleString else {
|
||||
@ -102,12 +104,19 @@ import UIKit
|
||||
// MARK: - Inits
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
setupView()
|
||||
initialSetup()
|
||||
}
|
||||
|
||||
public required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
setupView()
|
||||
initialSetup()
|
||||
}
|
||||
|
||||
public func initialSetup() {
|
||||
if !initialSetupPerformed {
|
||||
initialSetupPerformed = true
|
||||
setupView()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - MFViewProtocol
|
||||
@ -151,10 +160,6 @@ import UIKit
|
||||
self.listItemModel = model
|
||||
style(with: model.style)
|
||||
|
||||
if let backgroundColor = model.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
}
|
||||
|
||||
// Add the caret if there is an action and it's not declared hidden.
|
||||
if !customAccessoryView {
|
||||
if let _ = model.action, !(model.hideArrow ?? false) {
|
||||
@ -169,11 +174,15 @@ import UIKit
|
||||
addSeparatorsIfNeeded()
|
||||
bottomSeparatorView?.setWithModel(separator, nil, nil)
|
||||
}
|
||||
|
||||
if let moleculeModel = model as? MoleculeModelProtocol,
|
||||
let backgroundColor = moleculeModel.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
}
|
||||
}
|
||||
|
||||
open func reset() {
|
||||
molecule?.reset?()
|
||||
styleStandard()
|
||||
backgroundColor = .white
|
||||
}
|
||||
|
||||
@ -166,6 +166,8 @@ open class ThreeLayerTableViewController: MFProgrammaticTableViewController {
|
||||
}
|
||||
|
||||
// This extra view is needed because of the wonkiness of apple's table header. Things breaks if using autolayout.
|
||||
headerView.setNeedsLayout()
|
||||
headerView.layoutIfNeeded()
|
||||
MVMCoreUIUtility.sizeView(toFit: headerView)
|
||||
let tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: MVMCoreUIUtility.getWidth(), height: headerView.frame.height))
|
||||
tableHeaderView.addSubview(headerView)
|
||||
|
||||
@ -48,7 +48,8 @@ public class ContainerModel: ContainerModelProtocol, Codable {
|
||||
try container.encodeIfPresent(ContainerHelper.getAlignmentString(for: horizontalAlignment), forKey: .horizontalAlignment)
|
||||
try container.encodeIfPresent(useHorizontalMargins, forKey: .useHorizontalMargins)
|
||||
try container.encodeIfPresent(useVerticalMargins, forKey: .useVerticalMargins)
|
||||
try container.encodeIfPresent(topMarginPadding, forKey: .topMarginPadding)
|
||||
try container.encodeIfPresent(bottomMarginPadding, forKey: .bottomMarginPadding)
|
||||
// TODO: can add this back once we have type erasures.
|
||||
//try container.encodeIfPresent(topMarginPadding, forKey: .topMarginPadding)
|
||||
//try container.encodeIfPresent(bottomMarginPadding, forKey: .bottomMarginPadding)
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
|
||||
|
||||
public protocol ListItemModelProtocol: ContainerModelProtocol, MoleculeModelProtocol {
|
||||
public protocol ListItemModelProtocol: ContainerModelProtocol {
|
||||
var line: LineModel? { get set }
|
||||
var action: ActionModelProtocol? { get set }
|
||||
var hideArrow: Bool? { get set }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user