alignment updates

This commit is contained in:
Pfeil, Scott Robert 2019-12-16 11:19:30 -05:00
parent 7926a8579c
commit f610264327
9 changed files with 25 additions and 27 deletions

View File

@ -136,7 +136,7 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
return true return true
} }
open func alignment() -> UIStackView.Alignment { open func horizontalAlignment() -> UIStackView.Alignment {
return UIStackView.Alignment.leading; return UIStackView.Alignment.leading;
} }

View File

@ -156,7 +156,7 @@
return YES; return YES;
} }
- (UIStackViewAlignment)alignment { - (UIStackViewAlignment)horizontalAlignment {
return UIStackViewAlignmentLeading; return UIStackViewAlignmentLeading;
} }

View File

@ -131,7 +131,7 @@ extension CaretView: MVMCoreUIViewConstrainingProtocol {
return true return true
} }
open func alignment() -> UIStackView.Alignment { open func horizontalAlignment() -> UIStackView.Alignment {
return UIStackView.Alignment.leading; return UIStackView.Alignment.leading;
} }
} }

View File

@ -165,7 +165,7 @@ extension CheckboxWithLabelView {
layoutIfNeeded() layoutIfNeeded()
} }
override open func alignment() -> UIStackView.Alignment { override open func horizontalAlignment() -> UIStackView.Alignment {
return .leading return .leading
} }

View File

@ -598,7 +598,7 @@ extension Label {
return true return true
} }
public func alignment() -> UIStackView.Alignment { public func horizontalAlignment() -> UIStackView.Alignment {
return .leading return .leading
} }

View File

@ -193,7 +193,7 @@ const CGFloat SwitchShakeIntensity = 2;
return YES; return YES;
} }
- (UIStackViewAlignment)alignment { - (UIStackViewAlignment)horizontalAlignment {
return UIStackViewAlignmentTrailing; return UIStackViewAlignmentTrailing;
} }

View File

@ -217,7 +217,7 @@ public extension Container {
} }
if let verticalAlignmentString = json?.optionalStringForKey("verticalAlignment"), let alignment = ContainerHelper.getAlignment(for: verticalAlignmentString) ?? (view as? MVMCoreUIViewConstrainingProtocol)?.verticalAlignment?() { if let verticalAlignmentString = json?.optionalStringForKey("verticalAlignment"), let alignment = ContainerHelper.getAlignment(for: verticalAlignmentString) ?? (view as? MVMCoreUIViewConstrainingProtocol)?.verticalAlignment?() {
containerHelper.alignHorizontal(alignment) containerHelper.alignVertical(alignment)
} else if let alignment = (view as? MVMCoreUIViewConstrainingProtocol)?.verticalAlignment?() { } else if let alignment = (view as? MVMCoreUIViewConstrainingProtocol)?.verticalAlignment?() {
containerHelper.alignVertical(alignment) containerHelper.alignVertical(alignment)
} }

View File

@ -54,7 +54,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
return YES; return YES;
} }
- (UIStackViewAlignment)alignment { - (UIStackViewAlignment)horizontalAlignment {
return UIStackViewAlignmentLeading; return UIStackViewAlignmentLeading;
} }

View File

@ -135,26 +135,24 @@ open class MoleculeStackView: Container {
// Adds the molecules and sets the json. // Adds the molecules and sets the json.
for (index, map) in molecules.enumerated() { for (index, map) in molecules.enumerated() {
if let moleculeJSON = map.optionalDictionaryForKey(KeyMolecule) { var view: UIView?
var view: UIView? var stackItemModel: StackItemModel
var stackItemModel: StackItemModel if let item = items?[index] {
if let item = items?[index] { stackItemModel = item
stackItemModel = item item.update(with: map)
item.update(with: map) view = item.view
view = item.view (view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON(map, delegateObject: delegateObject, additionalData: nil)
(view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: nil) addStackItem(item, lastItem: index == molecules.count - 1)
addStackItem(item, lastItem: index == molecules.count - 1) } else {
} else { let stackItem = StackItem()
let stackItem = StackItem() stackItem.setWithJSON(map, delegateObject: delegateObject, additionalData: additionalData)
stackItem.setWithJSON(map, delegateObject: delegateObject, additionalData: additionalData) view = stackItem
view = stackItem stackItemModel = StackItemModel(with: stackItem, json: map)
stackItemModel = StackItemModel(with: stackItem, json: map) addStackItem(stackItemModel, lastItem: index == molecules.count - 1)
addStackItem(stackItemModel, lastItem: index == molecules.count - 1)
}
stackItemModel.useHorizontalMargins = moleculesShouldSetHorizontalMargins
stackItemModel.useVerticalMargins = moleculesShouldSetVerticalMargins
} }
stackItemModel.useHorizontalMargins = moleculesShouldSetHorizontalMargins
stackItemModel.useVerticalMargins = moleculesShouldSetVerticalMargins
} }
} }