Fix archive/outage banner.

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 2af0ba99b1
commit 1528f6f705

@ -73,34 +73,24 @@ class ReminderView: UIView {
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(gestureRecognizer:))) let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(gestureRecognizer:)))
self.addGestureRecognizer(tapGesture) self.addGestureRecognizer(tapGesture)
let container = UIView() let container = UIStackView()
container.axis = .horizontal
container.alignment = .center
container.isLayoutMarginsRelativeArrangement = true
self.addSubview(container) self.addSubview(container)
container.autoPinWidthToSuperview(withMargin: 16) container.layoutMargins = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16)
switch (mode) { container.autoPinToSuperviewEdges()
case .nag:
container.autoPinHeightToSuperview(withMargin: 16)
case .explanation:
container.autoPinHeightToSuperview(withMargin: 12)
}
// Margin: top and bottom 12 left and right 16.
// Label // Label
label.font = UIFont.ows_dynamicTypeSubheadline label.font = UIFont.ows_dynamicTypeSubheadline
container.addSubview(label) container.addArrangedSubview(label)
label.textColor = UIColor.black.withAlphaComponent(0.9) label.textColor = UIColor.black.withAlphaComponent(0.9)
label.numberOfLines = 0 label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping label.lineBreakMode = .byWordWrapping
label.autoPinLeadingToSuperviewMargin()
label.autoPinEdge(toSuperviewEdge: .top)
label.autoPinEdge(toSuperviewEdge: .bottom)
// Show the disclosure indicator if this reminder has a tap action. // Show the disclosure indicator if this reminder has a tap action.
if tapAction == nil { if tapAction != nil {
return
}
// Icon // Icon
let iconName = (self.isRTL() ? "system_disclosure_indicator_rtl" : "system_disclosure_indicator") let iconName = (self.isRTL() ? "system_disclosure_indicator_rtl" : "system_disclosure_indicator")
guard let iconImage = UIImage(named: iconName) else { guard let iconImage = UIImage(named: iconName) else {
@ -110,12 +100,9 @@ class ReminderView: UIView {
let iconView = UIImageView(image: iconImage.withRenderingMode(.alwaysTemplate)) let iconView = UIImageView(image: iconImage.withRenderingMode(.alwaysTemplate))
iconView.contentMode = .scaleAspectFit iconView.contentMode = .scaleAspectFit
iconView.tintColor = UIColor.black.withAlphaComponent(0.6) iconView.tintColor = UIColor.black.withAlphaComponent(0.6)
container.addSubview(iconView)
iconView.autoPinLeading(toTrailingEdgeOf: label, offset: 28)
iconView.autoPinTrailingToSuperviewMargin()
iconView.autoVCenterInSuperview()
iconView.autoSetDimension(.width, toSize: 13) iconView.autoSetDimension(.width, toSize: 13)
container.addArrangedSubview(iconView)
}
} }
@objc func handleTap(gestureRecognizer: UIGestureRecognizer) { @objc func handleTap(gestureRecognizer: UIGestureRecognizer) {

Loading…
Cancel
Save