From aa68712497002d46ef5a604bd5e84b268f927049 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 22 Dec 2017 02:59:21 +0300 Subject: Fix keyboard height constraint --- Juick/Main.storyboard | 52 +++++++++++---------------- Juick/Supporting Files/Juick-Info.plist | 2 +- Juick/ViewControllers/NewPostViewController.m | 9 +++-- Juick/Views/MessageCell.xib | 18 +++++----- Juick/Views/MessageInputView.xib | 14 ++++---- 5 files changed, 41 insertions(+), 54 deletions(-) diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index b717079..130f09d 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -257,47 +257,35 @@ - - - - - - - - - - - - - - - - - - - - + + - - - - - - - + + + + + + + + + + + + + - - - - + + + + - + diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index 06427c7..5035e69 100644 --- a/Juick/Supporting Files/Juick-Info.plist +++ b/Juick/Supporting Files/Juick-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.0.42 + 1.0.43 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 143dd96..e8c767c 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -26,6 +26,8 @@ - (void)viewDidLoad { [super viewDidLoad]; + self.paddingValue = self.bottomConstraint.constant; + [self.view setBackgroundColor:[ColorScheme mainBackground]]; if (_replyTo != nil) { MessageInputView *inputView = (MessageInputView *) self.inputAccessoryView; inputView.quoteText.text = _replyTo.text; @@ -63,11 +65,9 @@ } -(void) keyboardDidShow:(NSNotification *)sender { - CGRect frame = [sender.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; - CGRect newFrame = [self.view convertRect:frame fromView:[[UIApplication sharedApplication] delegate].window]; - [self.view layoutIfNeeded]; + CGRect keyboardRect = [sender.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; [UIView animateWithDuration:[sender.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue] animations:^{ - self.bottomConstraint.constant = newFrame.origin.y - CGRectGetHeight(self.view.frame) + self.paddingValue; + self.bottomConstraint.constant = keyboardRect.size.height - self.view.safeAreaInsets.bottom + self.paddingValue; [self.view layoutIfNeeded]; }]; } @@ -90,5 +90,4 @@ return _inputAccessoryView; } - @end diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index d32defe..bb7f9c5 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -20,10 +20,10 @@ - + - + @@ -32,16 +32,16 @@ - + - + @@ -78,20 +78,20 @@ - +