diff --git a/Source/SLKTextInputbar.m b/Source/SLKTextInputbar.m index ca970691..bd331b77 100644 --- a/Source/SLKTextInputbar.m +++ b/Source/SLKTextInputbar.m @@ -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)]; } @@ -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); @@ -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];