Changes to align accessoryview.
This commit is contained in:
parent
2de762d4cd
commit
400563bcdd
@ -19,6 +19,7 @@ import Foundation
|
|||||||
public let leftSubBody = Label(fontStyle: .RegularBodySmall)
|
public let leftSubBody = Label(fontStyle: .RegularBodySmall)
|
||||||
public let rightLabel = Label(fontStyle: .BoldBodySmall)
|
public let rightLabel = Label(fontStyle: .BoldBodySmall)
|
||||||
public var horizontalStack: Stack<StackModel>
|
public var horizontalStack: Stack<StackModel>
|
||||||
|
private let rightLabelStackItem: StackItem
|
||||||
public var stack: Stack<StackModel>
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: 12, standardiPadPortraitSize: 18)
|
public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: 12, standardiPadPortraitSize: 18)
|
||||||
@ -28,8 +29,14 @@ import Foundation
|
|||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
|
||||||
|
let horizontalStackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill),
|
||||||
|
StackItemModel(horizontalAlignment: .fill),
|
||||||
|
StackItemModel(horizontalAlignment: .trailing)],
|
||||||
|
axis: .horizontal, spacing: 8)
|
||||||
|
rightLabelStackItem = StackItem(andContain: rightLabel)
|
||||||
|
let horizontalStackItems = [StackItem(andContain: leftHeadline), StackItem(andContain: heart), rightLabelStackItem]
|
||||||
//horizontal stack with leftHeadline, heart, rightLabel
|
//horizontal stack with leftHeadline, heart, rightLabel
|
||||||
horizontalStack = Stack<StackModel>.createStack(with: [(view: leftHeadline, model: StackItemModel(horizontalAlignment: .fill)), (view: heart, model: StackItemModel(horizontalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing))], axis: .horizontal, spacing: 8)
|
horizontalStack = Stack<StackModel>(with: horizontalStackModel, stackItems: horizontalStackItems)
|
||||||
|
|
||||||
//stack with all components
|
//stack with all components
|
||||||
stack = Stack<StackModel>.createStack(with: [horizontalStack, leftBody, leftSubBody], axis: .vertical, spacing: 0)
|
stack = Stack<StackModel>.createStack(with: [horizontalStack, leftBody, leftSubBody], axis: .vertical, spacing: 0)
|
||||||
@ -76,6 +83,16 @@ import Foundation
|
|||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func alignAccessoryToHero() -> CGPoint? {
|
||||||
|
let heroCenter = super.alignAccessoryToHero()
|
||||||
|
|
||||||
|
if let heroCenter = heroCenter {
|
||||||
|
let convertedPoint = horizontalStack.convert(heroCenter, from: self)
|
||||||
|
rightLabelStackItem.containerHelper.alignCenterVerticalConstraint?.constant = convertedPoint.y - horizontalStack.bounds.midY
|
||||||
|
}
|
||||||
|
return heroCenter
|
||||||
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 120
|
return 120
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user