diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 59f8f1f33..dd4c26ede 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -896,6 +896,8 @@ NS_ASSUME_NONNULL_BEGIN [wrapper addSubview:downloadView]; [downloadView autoPinWidthToSuperview]; [downloadView autoVCenterInSuperview]; + [downloadView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual]; + [downloadView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual]; self.loadCellContentBlock = ^{ // Do nothing. diff --git a/SignalMessaging/Views/OWSLayerView.swift b/SignalMessaging/Views/OWSLayerView.swift new file mode 100644 index 000000000..5ff12aaa1 --- /dev/null +++ b/SignalMessaging/Views/OWSLayerView.swift @@ -0,0 +1,40 @@ +// +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// + +import Foundation + +@objc +class OWSLayerView: UIView { + let layoutCallback: ((UIView) -> Void) + + @objc + public required init(frame: CGRect, layoutCallback : @escaping (UIView) -> Void) { + self.layoutCallback = layoutCallback + super.init(frame: frame) + } + + required init?(coder aDecoder: NSCoder) { + self.layoutCallback = { _ in + } + super.init(coder: aDecoder) + } + + override var bounds: CGRect { + didSet { + layoutCallback(self) + } + } + + override var frame: CGRect { + didSet { + layoutCallback(self) + } + } + + override var center: CGPoint { + didSet { + layoutCallback(self) + } + } +}