diff --git a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift index 69062ea1..83ab4498 100644 --- a/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift +++ b/MVMCoreUI/Atoms/Views/StandardListItemWithImage.swift @@ -16,14 +16,10 @@ import UIKit let title = Label.commonLabelH3(true) let message = Label.commonLabelB3(true) - let button = ButtonView(frame: .zero) + let button = PrimaryButton.primaryTinyButton(false)! let imageloader = MFLoadImageView() let leftContainer = ViewConstrainingView.empty() - //------------------------------------------------------ - // MARK: - Constraints - //------------------------------------------------------ - //------------------------------------------------------ // MARK: - Initialization //------------------------------------------------------ @@ -54,17 +50,18 @@ import UIKit guard subviews.isEmpty else { return } + button.setAsSecondaryCustom() + addSubview(leftContainer) leftContainer.addSubview(title) leftContainer.addSubview(message) leftContainer.addSubview(button) addSubview(imageloader) + imageloader.imageView.contentMode = .scaleAspectFit imageloader.translatesAutoresizingMaskIntoConstraints = false button.translatesAutoresizingMaskIntoConstraints = false - imageloader.imageView.contentMode = .scaleAspectFit - leftContainer.topAnchor.constraint(equalTo: topAnchor).isActive = true leftContainer.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true @@ -76,28 +73,25 @@ import UIKit title.topAnchor.constraint(equalTo: topAnchor).isActive = true title.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - title.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true message.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 6).isActive = true message.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true - message.widthAnchor.constraint(equalTo: leftContainer.widthAnchor).isActive = true imageloader.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true layoutMarginsGuide.trailingAnchor.constraint(equalTo: imageloader.trailingAnchor).isActive = true imageloader.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true + imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true + bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true let imageloaderBottom = imageloader.bottomAnchor.constraint(equalTo: bottomAnchor) imageloaderBottom.priority = UILayoutPriority(249) imageloaderBottom.isActive = true - bottomAnchor.constraint(greaterThanOrEqualTo: imageloader.bottomAnchor).isActive = true - - imageloader.leadingAnchor.constraint(equalTo: leftContainer.trailingAnchor, constant: 16).isActive = true - button.topAnchor.constraint(equalTo: message.bottomAnchor, constant: 12).isActive = true button.leadingAnchor.constraint(equalTo: leftContainer.leadingAnchor).isActive = true + button.bottomAnchor.constraint(equalTo: leftContainer.bottomAnchor).isActive = true title.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) message.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) @@ -107,10 +101,18 @@ import UIKit title.setContentCompressionResistancePriority(.required, for: .vertical) message.setContentCompressionResistancePriority(.required, for: .vertical) + + imageloader.imageView.setContentCompressionResistancePriority(.required, for: .vertical) } override open func updateView(_ size: CGFloat) { super.updateView(size) + + title.updateView(size) + message.updateView(size) + button.updateView(size) + imageloader.updateView(size) + leftContainer.updateView(size) } override open func reset() { diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index ebac9da4..0e8a8e77 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -43,7 +43,8 @@ @"listItem": MoleculeTableViewCell.class, @"switchLineItem": SwitchLineItem.class, @"switch": Switch.class, - @"leftRightLabelView": LeftRightLabelView.class + @"leftRightLabelView": LeftRightLabelView.class, + @"standardListItemWithImage": StandardListItemWithImage.class } mutableCopy]; }); return mapping;