update table cell
This commit is contained in:
parent
362c9b3937
commit
dace6a6374
@ -22,6 +22,8 @@ import UIKit
|
|||||||
var imageWidth: CGFloat?
|
var imageWidth: CGFloat?
|
||||||
var imageHeight: CGFloat?
|
var imageHeight: CGFloat?
|
||||||
|
|
||||||
|
var delegateObject: MVMCoreUIDelegateObject?
|
||||||
|
|
||||||
// For keeping track of current state.
|
// For keeping track of current state.
|
||||||
private var edges: UIRectEdge?
|
private var edges: UIRectEdge?
|
||||||
private var spinnerHeight: CGFloat?
|
private var spinnerHeight: CGFloat?
|
||||||
@ -190,6 +192,7 @@ import UIKit
|
|||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
self.delegateObject = delegateObject
|
||||||
if let accessibilityString = json?.optionalStringForKey("accessibilityText") {
|
if let accessibilityString = json?.optionalStringForKey("accessibilityText") {
|
||||||
imageView.accessibilityLabel = accessibilityString
|
imageView.accessibilityLabel = accessibilityString
|
||||||
imageView.accessibilityTraits = .staticText
|
imageView.accessibilityTraits = .staticText
|
||||||
@ -223,6 +226,7 @@ import UIKit
|
|||||||
self?.loadingSpinnerHeightConstraint?.constant = 0
|
self?.loadingSpinnerHeightConstraint?.constant = 0
|
||||||
self?.loadingSpinner.pause()
|
self?.loadingSpinner.pause()
|
||||||
self?.addConstraints(width: width, height: height, size: image?.size)
|
self?.addConstraints(width: width, height: height, size: image?.size)
|
||||||
|
self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated?(self!)
|
||||||
completionHandler(image,data,isFallbackImage)
|
completionHandler(image,data,isFallbackImage)
|
||||||
})}
|
})}
|
||||||
|
|
||||||
|
|||||||
@ -12,4 +12,8 @@
|
|||||||
/// returns a module for the corresponding module name.
|
/// returns a module for the corresponding module name.
|
||||||
- (nullable NSDictionary *)getModuleWithName:(nullable NSString *)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
|
@end
|
||||||
|
|||||||
@ -106,6 +106,16 @@ open class MoleculeListTemplate: ThreeLayerTableViewController {
|
|||||||
return loadObject?.requestParameters?.modules
|
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
|
// MARK: - Convenience
|
||||||
/// Returns the (identifier, class) of the molecule for the given map.
|
/// Returns the (identifier, class) of the molecule for the given map.
|
||||||
func getMoleculeInfo(with molecule: [AnyHashable: Any]?) -> (identifier: String, class: AnyClass, molecule: [AnyHashable: Any])? {
|
func getMoleculeInfo(with molecule: [AnyHashable: Any]?) -> (identifier: String, class: AnyClass, molecule: [AnyHashable: Any])? {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user