From 38f7c792c11de815a3ca57bda72a03143df8fc59 Mon Sep 17 00:00:00 2001 From: Peter Evensen Date: Mon, 7 Jul 2014 15:31:48 -0500 Subject: [PATCH 1/2] fix:move input view based on delta to handle embedding --- SOMessaging/SOMessageInputView.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SOMessaging/SOMessageInputView.m b/SOMessaging/SOMessageInputView.m index 9016c6a..4930617 100644 --- a/SOMessaging/SOMessageInputView.m +++ b/SOMessaging/SOMessageInputView.m @@ -313,7 +313,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]; From f48bb5a26f5d60c83781f05355a6752fa601cc8a Mon Sep 17 00:00:00 2001 From: Peter Evensen Date: Wed, 6 Aug 2014 09:20:54 -0400 Subject: [PATCH 2/2] fix:msg edit y adjust when embedded in tab/nav --- SOMessaging/SOMessageInputView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SOMessaging/SOMessageInputView.m b/SOMessaging/SOMessageInputView.m index 4930617..be31008 100644 --- a/SOMessaging/SOMessageInputView.m +++ b/SOMessaging/SOMessageInputView.m @@ -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:^{