-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
* Fixed Xcode warnings + deprecating -shouldProcessTextForAutoCompletion: * Making SLKTextInputbar a UIView subclass instead, with its own hairline layout. This fixes #604 rendering SLKTVC useless in iOS 11 since UIToolBar's view hierarchy has drastically changed since, conflicting with the internal outlets of SLKTextInputbar * Changelog
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
|
||
@interface SLKTextInputbar () | ||
|
||
@property (nonatomic, strong) UIView *hairlineView; | ||
|
||
@property (nonatomic, strong) NSLayoutConstraint *textViewBottomMarginC; | ||
@property (nonatomic, strong) NSLayoutConstraint *contentViewHC; | ||
@property (nonatomic, strong) NSLayoutConstraint *leftButtonWC; | ||
|
@@ -83,14 +85,16 @@ - (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]; | ||
[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]; | ||
|
||
|
@@ -152,6 +156,16 @@ - (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]; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pchelnikov
|
||
} | ||
return _hairlineView; | ||
} | ||
|
||
- (UIView *)contentView | ||
{ | ||
if (!_contentView) { | ||
|
@@ -408,7 +422,8 @@ - (NSUInteger)slk_defaultNumberOfLines | |
|
||
- (void)setBackgroundColor:(UIColor *)color | ||
{ | ||
self.barTintColor = color; | ||
[super setBackgroundColor:color]; | ||
|
||
self.editorContentView.backgroundColor = color; | ||
} | ||
|
||
|
@@ -662,7 +677,7 @@ - (void)slk_setupViewConstraints | |
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[editorContentView]|" options:0 metrics:metrics views:views]]; | ||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[contentView]|" options:0 metrics:metrics views:views]]; | ||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[contentView(0)]|" options:0 metrics:metrics views:views]]; | ||
|
||
self.textViewBottomMarginC = [self slk_constraintForAttribute:NSLayoutAttributeBottom firstItem:self secondItem:self.textView]; | ||
self.editorContentViewHC = [self slk_constraintForAttribute:NSLayoutAttributeHeight firstItem:self.editorContentView secondItem:nil]; | ||
self.contentViewHC = [self slk_constraintForAttribute:NSLayoutAttributeHeight firstItem:self.contentView secondItem:nil];; | ||
|
2 comments
on commit 46113e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dzenbot please, make hairlineView optional or customizable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge kudos to you @dzenbot for fixing the iOS11 textinput interraction bug. <3
how can we style this/remove this?