Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Reverting #624 to be using UIToolbar again, specially for iPhone X co…
Browse files Browse the repository at this point in the history
…mpatibility so the bottom edge of the input bar expands to the bottom of the screen

Fixes #619
  • Loading branch information
Ignacio Romero committed Nov 1, 2017
1 parent 953ac90 commit fa390ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 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 : UIView
@interface SLKTextInputbar : UIToolbar

/** The centered text input view.
The maximum number of lines is configured by default, to best fit each devices dimensions.
Expand Down
20 changes: 5 additions & 15 deletions Source/SLKTextInputbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

@interface SLKTextInputbar ()

@property (nonatomic, strong) UIView *hairlineView;

@property (nonatomic, strong) NSLayoutConstraint *textViewBottomMarginC;
@property (nonatomic, strong) NSLayoutConstraint *contentViewHC;
@property (nonatomic, strong) NSLayoutConstraint *leftButtonWC;
Expand Down Expand Up @@ -85,15 +83,17 @@ - (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

// Since iOS 11, it is required to call -layoutSubviews before adding custom subviews
// so private UIToolbar subviews don't interfere on the touch hierarchy
[self layoutSubviews];

[self addSubview:self.editorContentView];
[self addSubview:self.leftButton];
[self addSubview:self.rightButton];
[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 @@ -156,16 +156,6 @@ - (SLKTextView *)textView
return _textView;
}

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

- (UIView *)contentView
{
if (!_contentView) {
Expand Down Expand Up @@ -422,7 +412,7 @@ - (NSUInteger)slk_defaultNumberOfLines

- (void)setBackgroundColor:(UIColor *)color
{
[super setBackgroundColor:color];
self.barTintColor = color;

self.editorContentView.backgroundColor = color;
}
Expand Down

0 comments on commit fa390ae

Please sign in to comment.