From 5287ab8f8c7f2e4718b417916ad0b9028812ef26 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 9 Apr 2018 17:15:56 -0400 Subject: [PATCH] Try 2: no more stack view // FREEBIE --- .../Cells/OWSQuotedMessageView.m | 2 + Signal/src/views/QuotedReplyPreview.swift | 73 +++++++++++-------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m index 2b6dd8ec0..fb7a3d02c 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSQuotedMessageView.m @@ -66,6 +66,8 @@ NS_ASSUME_NONNULL_BEGIN _quotedMessage = quotedMessage; _displayableQuotedText = displayableQuotedText; + [self createContents]; + return self; } diff --git a/Signal/src/views/QuotedReplyPreview.swift b/Signal/src/views/QuotedReplyPreview.swift index 34588b8de..0dfa1f328 100644 --- a/Signal/src/views/QuotedReplyPreview.swift +++ b/Signal/src/views/QuotedReplyPreview.swift @@ -73,38 +73,47 @@ class QuotedReplyPreview: UIView { cancelButton.imageView?.tintColor = foregroundColor cancelButton.addTarget(self, action: #selector(didTapCancel), for: .touchUpInside) -// let quoteStripe: UIView = UIView() -// quoteStripe.backgroundColor = authorColor +//// let quoteStripe: UIView = UIView() +//// quoteStripe.backgroundColor = authorColor +//// +//// let textColumn = UIView.container() +//// textColumn.addSubview(authorLabel) +//// textColumn.addSubview(bodyLabel) +//// +//// authorLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .bottom) +//// authorLabel.autoPinEdge(.bottom, to: .top, of: bodyLabel) +//// bodyLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .top) +//// +//// let contentViews: [UIView] = [textColumn, thumbnailView, cancelButton].flatMap { return $0 } // -// let textColumn = UIView.container() -// textColumn.addSubview(authorLabel) -// textColumn.addSubview(bodyLabel) -// -// authorLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .bottom) -// authorLabel.autoPinEdge(.bottom, to: .top, of: bodyLabel) -// bodyLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .top) -// -// let contentViews: [UIView] = [textColumn, thumbnailView, cancelButton].flatMap { return $0 } - - let contentViews: [UIView] = [quotedMessageView, cancelButton] - let contentRow = UIStackView(arrangedSubviews: contentViews) - contentRow.axis = .horizontal - self.addSubview(contentRow) -// self.addSubview(quoteStripe) -// -// // Layout -// -// let kQuoteStripeWidth: CGFloat = 4 -// self.layoutMargins = UIEdgeInsets(top: 6, -// left: kQuoteStripeWidth + 8, -// bottom: 2, -// right: 4) -// -// quoteStripe.autoPinEdge(toSuperviewEdge: .leading) -// quoteStripe.autoPinHeightToSuperview() -// quoteStripe.autoSetDimension(.width, toSize: kQuoteStripeWidth) -// - contentRow.autoPinEdgesToSuperviewMargins() +// let contentViews: [UIView] = [quotedMessageView, cancelButton] +// let contentRow = UIStackView(arrangedSubviews: contentViews) +// contentRow.axis = .horizontal +// self.addSubview(contentRow) +//// self.addSubview(quoteStripe) +//// +//// // Layout +//// +//// let kQuoteStripeWidth: CGFloat = 4 +//// self.layoutMargins = UIEdgeInsets(top: 6, +//// left: kQuoteStripeWidth + 8, +//// bottom: 2, +//// right: 4) +//// +//// quoteStripe.autoPinEdge(toSuperviewEdge: .leading) +//// quoteStripe.autoPinHeightToSuperview() +//// quoteStripe.autoSetDimension(.width, toSize: kQuoteStripeWidth) +//// +// contentRow.autoPinEdgesToSuperviewMargins() + + self.layoutMargins = .zero + + self.addSubview(quotedMessageView) + self.addSubview(cancelButton) + + quotedMessageView.autoPinEdges(toSuperviewMarginsExcludingEdge: .trailing) + cancelButton.autoPinEdges(toSuperviewMarginsExcludingEdge: .leading) + cancelButton.autoPinEdge(.leading, to: .trailing, of: quotedMessageView) cancelButton.autoSetDimensions(to: CGSize(width: 40, height: 40)) } @@ -113,7 +122,7 @@ class QuotedReplyPreview: UIView { // Used by stack view to determin size. override var intrinsicContentSize: CGSize { - return CGSize(width: 0, height: 30) + return CGSize(width: 0, height: 50) } // MARK: Actions