Rework layout of conversation input toolbar.

pull/1/head
Matthew Chen 7 years ago
parent 6ff6ee2e2e
commit 9b7ae86a6d

@ -10,10 +10,10 @@
#import "Signal-Swift.h" #import "Signal-Swift.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIFont+OWS.h" #import "UIFont+OWS.h"
#import "UIView+OWS.h"
#import "ViewControllerUtils.h" #import "ViewControllerUtils.h"
#import <SignalMessaging/OWSFormat.h> #import <SignalMessaging/OWSFormat.h>
#import <SignalMessaging/SignalMessaging-Swift.h> #import <SignalMessaging/SignalMessaging-Swift.h>
#import <SignalMessaging/UIView+OWS.h>
#import <SignalServiceKit/NSTimer+OWS.h> #import <SignalServiceKit/NSTimer+OWS.h>
#import <SignalServiceKit/TSQuotedMessage.h> #import <SignalServiceKit/TSQuotedMessage.h>
@ -199,22 +199,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.hStack.preservesSuperviewLayoutMargins = NO; self.hStack.preservesSuperviewLayoutMargins = NO;
self.preservesSuperviewLayoutMargins = NO; self.preservesSuperviewLayoutMargins = NO;
OWSLayerView *contentBorderView = [[OWSLayerView alloc] init]; [self.vStack addBorderViewWithColor:Theme.secondaryColor strokeWidth:CGHairlineWidth() cornerRadius:18.f];
contentBorderView.userInteractionEnabled = NO;
contentBorderView.backgroundColor = nil;
CAShapeLayer *contentBorderLayer = [CAShapeLayer new];
contentBorderLayer.strokeColor = Theme.secondaryColor.CGColor;
contentBorderLayer.fillColor = nil;
contentBorderLayer.lineWidth = CGHairlineWidth();
[contentBorderView.layer addSublayer:contentBorderLayer];
contentBorderView.layoutCallback = ^(UIView *layerView) {
contentBorderLayer.frame = layerView.bounds;
contentBorderLayer.path = [UIBezierPath bezierPathWithRoundedRect:layerView.bounds cornerRadius:18.f].CGPath;
};
[self.vStack addSubview:contentBorderView];
[contentBorderView autoPinEdgesToSuperviewEdges];
[contentBorderView setCompressionResistanceLow];
[contentBorderView setContentHuggingLow];
[self ensureShouldShowVoiceMemoButtonAnimated:NO doLayout:NO]; [self ensureShouldShowVoiceMemoButtonAnimated:NO doLayout:NO];
} }

@ -1,5 +1,5 @@
// //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// //
#import "OWSMath.h" #import "OWSMath.h"
@ -150,6 +150,8 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
- (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor; - (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor;
- (UIView *)addBorderViewWithColor:(UIColor *)color strokeWidth:(CGFloat)strokeWidth cornerRadius:(CGFloat)cornerRadius;
@end @end
#pragma mark - Macros #pragma mark - Macros

@ -1,5 +1,5 @@
// //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// //
#import "UIView+OWS.h" #import "UIView+OWS.h"
@ -556,10 +556,28 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
subview.backgroundColor = backgroundColor; subview.backgroundColor = backgroundColor;
[self addSubview:subview]; [self addSubview:subview];
[subview autoPinEdgesToSuperviewEdges]; [subview autoPinEdgesToSuperviewEdges];
[subview setCompressionResistanceLow];
[subview setContentHuggingLow];
[self sendSubviewToBack:subview]; [self sendSubviewToBack:subview];
return subview; return subview;
} }
- (UIView *)addBorderViewWithColor:(UIColor *)color strokeWidth:(CGFloat)strokeWidth cornerRadius:(CGFloat)cornerRadius
{
UIView *borderView = [UIView new];
borderView.userInteractionEnabled = NO;
borderView.backgroundColor = nil;
borderView.layer.borderColor = color.CGColor;
borderView.layer.borderWidth = strokeWidth;
borderView.layer.cornerRadius = cornerRadius;
[self addSubview:borderView];
[borderView autoPinEdgesToSuperviewEdges];
[borderView setCompressionResistanceLow];
[borderView setContentHuggingLow];
return borderView;
}
@end @end
CGFloat CGHairlineWidth() CGFloat CGHairlineWidth()

Loading…
Cancel
Save