|
19 | 19 |
|
20 | 20 | @interface SLKTextInputbar () |
21 | 21 |
|
22 | | -@property (nonatomic, strong) UIView *hairlineView; |
23 | | - |
24 | 22 | @property (nonatomic, strong) NSLayoutConstraint *textViewBottomMarginC; |
25 | 23 | @property (nonatomic, strong) NSLayoutConstraint *contentViewHC; |
26 | 24 | @property (nonatomic, strong) NSLayoutConstraint *leftButtonWC; |
@@ -85,15 +83,17 @@ - (void)slk_commonInit |
85 | 83 | self.autoHideRightButton = YES; |
86 | 84 | self.editorContentViewHeight = 38.0; |
87 | 85 | self.contentInset = UIEdgeInsetsMake(5.0, 8.0, 5.0, 8.0); |
88 | | - 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 |
| 86 | + |
| 87 | + // Since iOS 11, it is required to call -layoutSubviews before adding custom subviews |
| 88 | + // so private UIToolbar subviews don't interfere on the touch hierarchy |
| 89 | + [self layoutSubviews]; |
89 | 90 |
|
90 | 91 | [self addSubview:self.editorContentView]; |
91 | 92 | [self addSubview:self.leftButton]; |
92 | 93 | [self addSubview:self.rightButton]; |
93 | 94 | [self addSubview:self.textView]; |
94 | 95 | [self addSubview:self.charCountLabel]; |
95 | 96 | [self addSubview:self.contentView]; |
96 | | - [self addSubview:self.hairlineView]; |
97 | 97 |
|
98 | 98 | [self slk_setupViewConstraints]; |
99 | 99 | [self slk_updateConstraintConstants]; |
@@ -156,16 +156,6 @@ - (SLKTextView *)textView |
156 | 156 | return _textView; |
157 | 157 | } |
158 | 158 |
|
159 | | -- (UIView *)hairlineView |
160 | | -{ |
161 | | - if (!_hairlineView) { |
162 | | - _hairlineView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, [UIScreen mainScreen].bounds.size.width, 0.5)]; |
163 | | - _hairlineView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin; |
164 | | - _hairlineView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3]; |
165 | | - } |
166 | | - return _hairlineView; |
167 | | -} |
168 | | - |
169 | 159 | - (UIView *)contentView |
170 | 160 | { |
171 | 161 | if (!_contentView) { |
@@ -422,7 +412,7 @@ - (NSUInteger)slk_defaultNumberOfLines |
422 | 412 |
|
423 | 413 | - (void)setBackgroundColor:(UIColor *)color |
424 | 414 | { |
425 | | - [super setBackgroundColor:color]; |
| 415 | + self.barTintColor = color; |
426 | 416 |
|
427 | 417 | self.editorContentView.backgroundColor = color; |
428 | 418 | } |
|
0 commit comments