Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-10-24 09:41:03 -04:00
parent bf8d694eb4
commit c1f35a0ea6
2 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#import "ConversationInputToolbar.h"
#import "ConversationInputTextView.h"
#import "OWSMath.h"
#import "Signal-Swift.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
@ -222,7 +223,7 @@ static void *kConversationInputTextViewObservingContext = &kConversationInputTex
const CGFloat kMaxTextViewHeight = 100.f;
const CGFloat textViewDesiredHeight = (self.inputTextView.contentSize.height + self.inputTextView.contentInset.top
+ self.inputTextView.contentInset.bottom);
const CGFloat textViewHeight = ceil(MAX(kMinTextViewHeight, MIN(kMaxTextViewHeight, textViewDesiredHeight)));
const CGFloat textViewHeight = ceil(Clamp(textViewDesiredHeight, kMinTextViewHeight, kMaxTextViewHeight));
const CGFloat kMinContentHeight = kMinTextViewHeight + textViewVInset * 2;
if (self.attachmentToApprove) {

View File

@ -173,6 +173,11 @@ class MediaMessageView: UIView, OWSAudioAttachmentPlayerDelegate {
private func addSubviewWithScaleAspectFitLayout(view: UIView, aspectRatio: CGFloat) {
self.addSubview(view)
// This emulates the behavior of contentMode = .scaleAspectFit using
// iOS auto layout constraints.
//
// This allows ConversationInputToolbar to place the "cancel" button
// in the upper-right hand corner of the preview content.
view.autoCenterInSuperview()
view.autoPin(toAspectRatio:aspectRatio)
view.autoMatch(.width, to: .width, of: self, withMultiplier: 1.0, relation: .lessThanOrEqual)