diff --git a/Examples/Messenger-Shared/MessageViewController.m b/Examples/Messenger-Shared/MessageViewController.m index a7663560..8bf38a9f 100644 --- a/Examples/Messenger-Shared/MessageViewController.m +++ b/Examples/Messenger-Shared/MessageViewController.m @@ -446,31 +446,33 @@ - (void) didLongPressLeftButton:(UIGestureRecognizer *)sender - (void)didPressRightButton:(id)sender { - // Notifies the view controller when the right button's action has been triggered, manually or by using the keyboard return key. + //comment due to the lib code modified. Right action handled differently - // This little trick validates any pending auto-correction or auto-spelling just after hitting the 'Send' button - [self.textView refreshFirstResponder]; - - Message *message = [Message new]; - message.username = [LoremIpsum name]; - message.text = [self.textView.text copy]; - - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; - UITableViewRowAnimation rowAnimation = self.inverted ? UITableViewRowAnimationBottom : UITableViewRowAnimationTop; - UITableViewScrollPosition scrollPosition = self.inverted ? UITableViewScrollPositionBottom : UITableViewScrollPositionTop; - - [self.tableView beginUpdates]; - [self.messages insertObject:message atIndex:0]; - [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:rowAnimation]; - [self.tableView endUpdates]; - - [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:YES]; - - // Fixes the cell from blinking (because of the transform, when using translucent cells) - // See https://github.com/slackhq/SlackTextViewController/issues/94#issuecomment-69929927 - [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; - - [super didPressRightButton:sender]; +// // Notifies the view controller when the right button's action has been triggered, manually or by using the keyboard return key. +// +// // This little trick validates any pending auto-correction or auto-spelling just after hitting the 'Send' button +// [self.textView refreshFirstResponder]; +// +// Message *message = [Message new]; +// message.username = [LoremIpsum name]; +// message.text = [self.textView.text copy]; +// +// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; +// UITableViewRowAnimation rowAnimation = self.inverted ? UITableViewRowAnimationBottom : UITableViewRowAnimationTop; +// UITableViewScrollPosition scrollPosition = self.inverted ? UITableViewScrollPositionBottom : UITableViewScrollPositionTop; +// +// [self.tableView beginUpdates]; +// [self.messages insertObject:message atIndex:0]; +// [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:rowAnimation]; +// [self.tableView endUpdates]; +// +// [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:YES]; +// +// // Fixes the cell from blinking (because of the transform, when using translucent cells) +// // See https://github.com/slackhq/SlackTextViewController/issues/94#issuecomment-69929927 +// [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; +// +// [super didPressRightButton:sender]; } - (void)didPressArrowKey:(UIKeyCommand *)keyCommand diff --git a/Source/SLKTextViewController.m b/Source/SLKTextViewController.m index 2b977d33..aa85d721 100644 --- a/Source/SLKTextViewController.m +++ b/Source/SLKTextViewController.m @@ -237,6 +237,12 @@ - (void)viewDidLayoutSubviews [super viewDidLayoutSubviews]; } +- (void) viewSafeAreaInsetsDidChange +{ + [super viewSafeAreaInsetsDidChange]; + [self slk_updateViewConstraints]; +} + #pragma mark - Getters @@ -437,6 +443,10 @@ - (CGFloat)slk_appropriateBottomMargin if (tabBar && !tabBar.hidden && !self.hidesBottomBarWhenPushed) { return CGRectGetHeight(tabBar.frame); } + + if(@available(iOS 11.0, *)) { + return self.view.safeAreaInsets.bottom; + } } return 0.0; @@ -2270,7 +2280,7 @@ - (void)slk_setupViewConstraints NSDictionary *views = @{@"scrollView": self.scrollViewProxy, @"autoCompletionView": self.autoCompletionView, @"typingIndicatorView": self.typingIndicatorProxyView, - @"textInputbar": self.textInputbar, + @"textInputbar": self.textInputbar }; [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView(0@750)][typingIndicatorView(0)]-0@999-[textInputbar(0)]|" options:0 metrics:nil views:views]];