Fix broken constraint

pull/364/head
Niels Andriesse 4 years ago
parent b023b1be94
commit 1822b661e4

@ -67,7 +67,7 @@ final class NewClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelegat
separator.backgroundColor = Colors.separator separator.backgroundColor = Colors.separator
separator.set(.height, to: Values.separatorThickness) separator.set(.height, to: Values.separatorThickness)
mainStackView.addArrangedSubview(separator) mainStackView.addArrangedSubview(separator)
tableView.set(.height, to: CGFloat(contacts.count * 67)) // A cell is exactly 67 points high tableView.set(.height, to: CGFloat(contacts.count * 65)) // A cell is exactly 65 points high
tableView.set(.width, to: UIScreen.main.bounds.width) tableView.set(.width, to: UIScreen.main.bounds.width)
mainStackView.addArrangedSubview(tableView) mainStackView.addArrangedSubview(tableView)
let scrollView = UIScrollView(wrapping: mainStackView, withInsets: UIEdgeInsets.zero) let scrollView = UIScrollView(wrapping: mainStackView, withInsets: UIEdgeInsets.zero)

@ -50,34 +50,31 @@ final class UserCell : UITableViewCell {
} }
private func setUpViewHierarchy() { private func setUpViewHierarchy() {
// Set the cell background color // Background color
backgroundColor = Colors.cellBackground backgroundColor = Colors.cellBackground
// Set up the highlight color // Highlight color
let selectedBackgroundView = UIView() let selectedBackgroundView = UIView()
selectedBackgroundView.backgroundColor = .clear // Disabled for now selectedBackgroundView.backgroundColor = .clear // Disabled for now
self.selectedBackgroundView = selectedBackgroundView self.selectedBackgroundView = selectedBackgroundView
// Set up the profile picture image view // Profile picture image view
let profilePictureViewSize = Values.smallProfilePictureSize let profilePictureViewSize = Values.smallProfilePictureSize
profilePictureView.set(.width, to: profilePictureViewSize) profilePictureView.set(.width, to: profilePictureViewSize)
profilePictureView.set(.height, to: profilePictureViewSize) profilePictureView.set(.height, to: profilePictureViewSize)
profilePictureView.size = profilePictureViewSize profilePictureView.size = profilePictureViewSize
// Set up the main stack view // Main stack view
let stackView = UIStackView(arrangedSubviews: [ profilePictureView, displayNameLabel, accessoryImageView ]) let spacer = UIView.hStretchingSpacer()
spacer.widthAnchor.constraint(greaterThanOrEqualToConstant: Values.mediumSpacing).isActive = true
let stackView = UIStackView(arrangedSubviews: [ profilePictureView, UIView.hSpacer(Values.mediumSpacing), displayNameLabel, spacer, accessoryImageView ])
stackView.axis = .horizontal stackView.axis = .horizontal
stackView.alignment = .center stackView.alignment = .center
stackView.spacing = Values.mediumSpacing stackView.isLayoutMarginsRelativeArrangement = true
stackView.layoutMargins = UIEdgeInsets(uniform: Values.mediumSpacing)
contentView.addSubview(stackView) contentView.addSubview(stackView)
stackView.pin(.leading, to: .leading, of: contentView, withInset: Values.mediumSpacing) stackView.pin(to: contentView)
stackView.pin(.top, to: .top, of: contentView, withInset: Values.mediumSpacing) stackView.set(.width, to: UIScreen.main.bounds.width)
contentView.pin(.trailing, to: .trailing, of: stackView, withInset: Values.mediumSpacing)
contentView.pin(.bottom, to: .bottom, of: stackView, withInset: Values.mediumSpacing)
stackView.set(.width, to: UIScreen.main.bounds.width - 2 * Values.mediumSpacing)
// Set up the separator // Set up the separator
contentView.addSubview(separator) contentView.addSubview(separator)
separator.pin(.leading, to: .leading, of: contentView) separator.pin([ UIView.HorizontalEdge.leading, UIView.VerticalEdge.bottom, UIView.HorizontalEdge.trailing ], to: contentView)
contentView.pin(.trailing, to: .trailing, of: separator)
separator.pin(.bottom, to: .bottom, of: contentView)
separator.set(.width, to: UIScreen.main.bounds.width)
} }
// MARK: Updating // MARK: Updating

Loading…
Cancel
Save