Try 2: no more stack view

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 5807ba69ca
commit 5287ab8f8c

@ -66,6 +66,8 @@ NS_ASSUME_NONNULL_BEGIN
_quotedMessage = quotedMessage; _quotedMessage = quotedMessage;
_displayableQuotedText = displayableQuotedText; _displayableQuotedText = displayableQuotedText;
[self createContents];
return self; return self;
} }

@ -73,38 +73,47 @@ class QuotedReplyPreview: UIView {
cancelButton.imageView?.tintColor = foregroundColor cancelButton.imageView?.tintColor = foregroundColor
cancelButton.addTarget(self, action: #selector(didTapCancel), for: .touchUpInside) cancelButton.addTarget(self, action: #selector(didTapCancel), for: .touchUpInside)
// let quoteStripe: UIView = UIView() //// let quoteStripe: UIView = UIView()
// quoteStripe.backgroundColor = authorColor //// 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() // let contentViews: [UIView] = [quotedMessageView, cancelButton]
// textColumn.addSubview(authorLabel) // let contentRow = UIStackView(arrangedSubviews: contentViews)
// textColumn.addSubview(bodyLabel) // contentRow.axis = .horizontal
// // self.addSubview(contentRow)
// authorLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .bottom) //// self.addSubview(quoteStripe)
// authorLabel.autoPinEdge(.bottom, to: .top, of: bodyLabel) ////
// bodyLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .top) //// // Layout
// ////
// let contentViews: [UIView] = [textColumn, thumbnailView, cancelButton].flatMap { return $0 } //// let kQuoteStripeWidth: CGFloat = 4
//// self.layoutMargins = UIEdgeInsets(top: 6,
let contentViews: [UIView] = [quotedMessageView, cancelButton] //// left: kQuoteStripeWidth + 8,
let contentRow = UIStackView(arrangedSubviews: contentViews) //// bottom: 2,
contentRow.axis = .horizontal //// right: 4)
self.addSubview(contentRow) ////
// self.addSubview(quoteStripe) //// quoteStripe.autoPinEdge(toSuperviewEdge: .leading)
// //// quoteStripe.autoPinHeightToSuperview()
// // Layout //// quoteStripe.autoSetDimension(.width, toSize: kQuoteStripeWidth)
// ////
// let kQuoteStripeWidth: CGFloat = 4 // contentRow.autoPinEdgesToSuperviewMargins()
// self.layoutMargins = UIEdgeInsets(top: 6,
// left: kQuoteStripeWidth + 8, self.layoutMargins = .zero
// bottom: 2,
// right: 4) self.addSubview(quotedMessageView)
// self.addSubview(cancelButton)
// quoteStripe.autoPinEdge(toSuperviewEdge: .leading)
// quoteStripe.autoPinHeightToSuperview() quotedMessageView.autoPinEdges(toSuperviewMarginsExcludingEdge: .trailing)
// quoteStripe.autoSetDimension(.width, toSize: kQuoteStripeWidth) cancelButton.autoPinEdges(toSuperviewMarginsExcludingEdge: .leading)
// cancelButton.autoPinEdge(.leading, to: .trailing, of: quotedMessageView)
contentRow.autoPinEdgesToSuperviewMargins()
cancelButton.autoSetDimensions(to: CGSize(width: 40, height: 40)) cancelButton.autoSetDimensions(to: CGSize(width: 40, height: 40))
} }
@ -113,7 +122,7 @@ class QuotedReplyPreview: UIView {
// Used by stack view to determin size. // Used by stack view to determin size.
override var intrinsicContentSize: CGSize { override var intrinsicContentSize: CGSize {
return CGSize(width: 0, height: 30) return CGSize(width: 0, height: 50)
} }
// MARK: Actions // MARK: Actions

Loading…
Cancel
Save