Skip to content

Commit

Permalink
Updated right button to display image with proper constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
intoxicated committed Nov 23, 2017
1 parent 41a017a commit 139da40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHSlackTextViewController.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@version = "1.10.12"
@version = "1.10.13"

Pod::Spec.new do |s|
s.name = "CHSlackTextViewController"
Expand Down
11 changes: 11 additions & 0 deletions Source/SLKTextInputbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ - (void)slk_commonInit

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

self.barState = SLKInputBarStateNormal;
Expand Down Expand Up @@ -780,6 +781,15 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
[self slk_updateConstraintConstants];
}
}
else if ([object isEqual:self.rightButton.imageView] && [keyPath isEqualToString:NSStringFromSelector(@selector(image))]) {

UIImage *newImage = change[NSKeyValueChangeNewKey];
UIImage *oldImage = change[NSKeyValueChangeOldKey];

if (![newImage isEqual:oldImage]) {
[self slk_updateConstraintConstants];
}
}
else if ([object isEqual:self.rightButton.titleLabel] && [keyPath isEqualToString:NSStringFromSelector(@selector(font))]) {

[self slk_updateConstraintConstants];
Expand Down Expand Up @@ -817,6 +827,7 @@ - (void)dealloc

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

Expand Down

0 comments on commit 139da40

Please sign in to comment.