From 1fcf25fabde4ab317ba15277676f36bd7fe9c48d Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Tue, 26 Jun 2018 10:45:10 -0600 Subject: [PATCH] FIX: compose search group cell We switched sizing to automatic, but cell wasn't autolayout ready. --- Signal/src/views/GroupTableViewCell.swift | 30 +++++++++-------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/Signal/src/views/GroupTableViewCell.swift b/Signal/src/views/GroupTableViewCell.swift index c2272913c..805b66bbe 100644 --- a/Signal/src/views/GroupTableViewCell.swift +++ b/Signal/src/views/GroupTableViewCell.swift @@ -16,35 +16,27 @@ import SignalServiceKit init() { super.init(style: .default, reuseIdentifier: TAG) - self.contentView.addSubview(avatarView) - - let textContainer = UIView.container() - textContainer.addSubview(nameLabel) - textContainer.addSubview(subtitleLabel) - self.contentView.addSubview(textContainer) - // Font config nameLabel.font = .ows_dynamicTypeBody subtitleLabel.font = UIFont.ows_regularFont(withSize: 11.0) subtitleLabel.textColor = UIColor.ows_darkGray - // Listen to notifications... - // TODO avatar, group name change, group membership change, group member name change - // Layout - nameLabel.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets.zero, excludingEdge: .bottom) - subtitleLabel.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets.zero, excludingEdge: .top) - subtitleLabel.autoPinEdge(.top, to: .bottom, of: nameLabel) - - avatarView.autoPinLeadingToSuperviewMargin() - avatarView.autoVCenterInSuperview() avatarView.autoSetDimension(.width, toSize: CGFloat(kContactCellAvatarSize)) avatarView.autoPinToSquareAspectRatio() - textContainer.autoPinEdge(.leading, to: .trailing, of: avatarView, withOffset: kContactCellAvatarTextMargin) - textContainer.autoPinTrailingToSuperviewMargin() - textContainer.autoVCenterInSuperview() + let textRows = UIStackView(arrangedSubviews: [nameLabel, subtitleLabel]) + textRows.axis = .vertical + textRows.alignment = .leading + + let columns = UIStackView(arrangedSubviews: [avatarView, textRows]) + columns.axis = .horizontal + columns.alignment = .center + columns.spacing = kContactCellAvatarTextMargin + + self.contentView.addSubview(columns) + columns.autoPinEdgesToSuperviewMargins() } required init?(coder aDecoder: NSCoder) {