Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
Fixed bottom offset with transparent Tab Bar (#1588)
Browse files Browse the repository at this point in the history
  • Loading branch information
evfemist authored and jessesquires committed May 23, 2016
1 parent 40ae3b2 commit 3b4dc8f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions JSQMessagesViewController/Controllers/JSQMessagesViewController.m
Expand Up @@ -221,6 +221,15 @@ - (void)viewDidAppear:(BOOL)animated
}
}

- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];

if (!self.inputToolbar.contentView.textView.isFirstResponder) {
[self jsq_setToolbarBottomLayoutGuideConstant:self.bottomLayoutGuide.length];
}
}

- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
Expand Down Expand Up @@ -824,13 +833,13 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N

- (void)keyboardController:(JSQMessagesKeyboardController *)keyboardController keyboardDidChangeFrame:(CGRect)keyboardFrame
{
if (![self.inputToolbar.contentView.textView isFirstResponder] && self.toolbarBottomLayoutGuide.constant == 0.0f) {
if (![self.inputToolbar.contentView.textView isFirstResponder] && self.toolbarBottomLayoutGuide.constant == self.bottomLayoutGuide.length) {
return;
}

CGFloat heightFromBottom = CGRectGetMaxY(self.collectionView.frame) - CGRectGetMinY(keyboardFrame);

heightFromBottom = MAX(0.0f, heightFromBottom);
heightFromBottom = MAX(self.bottomLayoutGuide.length, heightFromBottom);

[self jsq_setToolbarBottomLayoutGuideConstant:heightFromBottom];
}
Expand Down Expand Up @@ -868,7 +877,7 @@ - (void)jsq_handleInteractivePopGestureRecognizer:(UIGestureRecognizer *)gesture
[self.inputToolbar.contentView.textView resignFirstResponder];
[UIView animateWithDuration:0.0
animations:^{
[self jsq_setToolbarBottomLayoutGuideConstant:0.0f];
[self jsq_setToolbarBottomLayoutGuideConstant:self.bottomLayoutGuide.length];
}];

UIView *snapshot = [self.view snapshotViewAfterScreenUpdates:YES];
Expand Down

0 comments on commit 3b4dc8f

Please sign in to comment.