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

inputbar left button: fixes text-only button not being displayed #654

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Source/SLKTextInputbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ - (void)slk_commonInit

[self slk_registerTo:self.layer forSelector:@selector(position)];
[self slk_registerTo:self.leftButton.imageView forSelector:@selector(image)];
[self slk_registerTo:self.leftButton.titleLabel forSelector:@selector(font)];
[self slk_registerTo:self.leftButton.titleLabel forSelector:@selector(text)];
[self slk_registerTo:self.rightButton.titleLabel forSelector:@selector(font)];
}

Expand Down Expand Up @@ -706,7 +708,7 @@ - (void)slk_updateConstraintConstants
else {
self.editorContentViewHC.constant = zero;

CGSize leftButtonSize = [self.leftButton imageForState:self.leftButton.state].size;
CGSize leftButtonSize = [self.leftButton intrinsicContentSize];

if (leftButtonSize.width > 0) {
self.leftButtonHC.constant = roundf(leftButtonSize.height);
Expand Down Expand Up @@ -762,6 +764,11 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
[self slk_updateConstraintConstants];
}
}
else if ([object isEqual:self.leftButton.titleLabel] &&
([keyPath isEqualToString:NSStringFromSelector(@selector(font))]
|| [keyPath isEqualToString:NSStringFromSelector(@selector(text))])) {
[self slk_updateConstraintConstants];
}
else if ([object isEqual:self.rightButton.titleLabel] && [keyPath isEqualToString:NSStringFromSelector(@selector(font))]) {

[self slk_updateConstraintConstants];
Expand Down