update table cell
This commit is contained in:
parent
362c9b3937
commit
dace6a6374
@ -22,6 +22,8 @@ import UIKit
|
||||
var imageWidth: CGFloat?
|
||||
var imageHeight: CGFloat?
|
||||
|
||||
var delegateObject: MVMCoreUIDelegateObject?
|
||||
|
||||
// For keeping track of current state.
|
||||
private var edges: UIRectEdge?
|
||||
private var spinnerHeight: CGFloat?
|
||||
@ -190,6 +192,7 @@ import UIKit
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
self.delegateObject = delegateObject
|
||||
if let accessibilityString = json?.optionalStringForKey("accessibilityText") {
|
||||
imageView.accessibilityLabel = accessibilityString
|
||||
imageView.accessibilityTraits = .staticText
|
||||
@ -223,6 +226,7 @@ import UIKit
|
||||
self?.loadingSpinnerHeightConstraint?.constant = 0
|
||||
self?.loadingSpinner.pause()
|
||||
self?.addConstraints(width: width, height: height, size: image?.size)
|
||||
self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated?(self!)
|
||||
completionHandler(image,data,isFallbackImage)
|
||||
})}
|
||||
|
||||
|
||||
@ -12,4 +12,8 @@
|
||||
/// returns a module for the corresponding module name.
|
||||
- (nullable NSDictionary *)getModuleWithName:(nullable NSString *)name;
|
||||
|
||||
@optional
|
||||
/// Notifies the delegate that the molecule layout update. Should be called when the layout may change due to an async method.
|
||||
- (void)moleculeLayoutUpdated:(nonnull UIView <MVMCoreUIMoleculeViewProtocol>*)molecule;
|
||||
|
||||
@end
|
||||
|
||||
@ -106,6 +106,16 @@ open class MoleculeListTemplate: ThreeLayerTableViewController {
|
||||
return loadObject?.requestParameters?.modules
|
||||
}
|
||||
|
||||
// MARK: - MoleculeDelegateProtocol
|
||||
open override func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
|
||||
if let tableView = tableView {
|
||||
let point = molecule.convert(molecule.bounds.origin, to: tableView)
|
||||
if let indexPath = tableView.indexPathForRow(at: point) {
|
||||
tableView.reloadRows(at: [indexPath], with: .none)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Convenience
|
||||
/// Returns the (identifier, class) of the molecule for the given map.
|
||||
func getMoleculeInfo(with molecule: [AnyHashable: Any]?) -> (identifier: String, class: AnyClass, molecule: [AnyHashable: Any])? {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user