Skip to content
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
11 changes: 9 additions & 2 deletions SOMessaging/SOMessageInputView.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ - (void)adjustTextViewSize
if (frm.size.height < self.textMaxHeight) {
if (frm.size.height < self.textInitialHeight) {
frm.size.height = self.textInitialHeight;
frm.origin.y = self.superview.bounds.size.height - frm.size.height - keyboardFrame.size.height;
// adjust to global coordinates to compensate for the chat view being contained in a tab bar
// and navigation controller
CGRect globalFrame = [self.superview convertRect:frm toView:nil];
delta = (self.window.bounds.size.height - frm.size.height - keyboardFrame.size.height) - globalFrame.origin.y;
frm.origin.y += delta;
}

[UIView animateWithDuration:0.3 animations:^{
Expand Down Expand Up @@ -313,7 +317,10 @@ - (void)handleKeyboardWillShowNote:(NSNotification *)notification

CGRect frame = self.frame;
// calculate the absolute ending point (based on the window rather than superview, which could be contained in a tab bar or tool bar)
frame.origin.y = windowRect.size.height - frame.size.height - keyboardRect.size.height;
// adjust the y based on the change needed to handle any embedding
CGRect globalFrame = [self.superview convertRect:self.frame toView:nil];
CGFloat delta = (windowRect.size.height - frame.size.height - keyboardRect.size.height) - globalFrame.origin.y;
frame.origin.y += delta;
initialInputViewPosYWhenKeyboardIsShown = frame.origin.y;

[self adjustTableViewWithCurve:YES scrollsToBottom:YES];
Expand Down