Skip to content

Commit

Permalink
follow slackhq#624 fix and change uitextinputbar to uiview instead of…
Browse files Browse the repository at this point in the history
… uitoolbar
  • Loading branch information
fans3210 committed Sep 25, 2017
1 parent 4e3d83d commit 3f0edf4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/SLKTextInputbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef NS_ENUM(NSUInteger, SLKCounterPosition) {
NS_ASSUME_NONNULL_BEGIN

/** @name A custom tool bar encapsulating messaging controls. */
@interface SLKTextInputbar : UIToolbar
@interface SLKTextInputbar : UIView

/** The centered text input view.
The maximum number of lines is configured by default, to best fit each devices dimensions.
Expand Down
20 changes: 19 additions & 1 deletion Source/SLKTextInputbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ @interface SLKTextInputbar ()
@property (nonatomic, strong) NSLayoutConstraint *rightButtonTopMarginC;
@property (nonatomic, strong) NSLayoutConstraint *rightButtonBottomMarginC;
@property (nonatomic, strong) NSLayoutConstraint *editorContentViewHC;

@property (strong, nonatomic) UIView *hairlineView;

@property (nonatomic, strong) NSArray *charCountLabelVCs;

@property (nonatomic, strong) UILabel *charCountLabel;
Expand Down Expand Up @@ -95,6 +98,7 @@ - (void)slk_commonInit
self.autoHideRightButton = YES;
self.editorContentViewHeight = 38.0;
self.contentInset = UIEdgeInsetsMake(5.0, 8.0, 5.0, 8.0);
self.backgroundColor = [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1.0]; //UIToolbar native bar tint color

[self addSubview:self.editorContentView];
[self addSubview:self.leftButton];
Expand All @@ -103,6 +107,7 @@ - (void)slk_commonInit
[self addSubview:self.textView];
[self addSubview:self.charCountLabel];
[self addSubview:self.contentView];
[self addSubview:self.hairlineView];

[self slk_setupViewConstraints];
[self slk_updateConstraintConstants];
Expand Down Expand Up @@ -165,6 +170,17 @@ - (SLKTextView *)textView
}
return _textView;
}

- (UIView *) hairlineView
{
if (!_hairlineView) {
_hairlineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 0.5)];
_hairlineView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin;
_hairlineView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
}

return _hairlineView;
}

- (UIView *)contentView
{
Expand Down Expand Up @@ -435,7 +451,9 @@ - (NSUInteger)slk_defaultNumberOfLines

- (void)setBackgroundColor:(UIColor *)color
{
self.barTintColor = color;
// self.barTintColor = color;

[super setBackgroundColor:color];
self.editorContentView.backgroundColor = color;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2280,7 +2280,7 @@ - (void)slk_setupViewConstraints
NSDictionary *views = @{@"scrollView": self.scrollViewProxy,
@"autoCompletionView": self.autoCompletionView,
@"typingIndicatorView": self.typingIndicatorProxyView,
@"textInputbar": self.textInputbar
@"textInputbar": self.textInputbar,
};

[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView(0@750)][typingIndicatorView(0)]-0@999-[textInputbar(0)]|" options:0 metrics:nil views:views]];
Expand Down

0 comments on commit 3f0edf4

Please sign in to comment.