diff options
Diffstat (limited to 'Juick/ViewControllers/NewPostViewController.m')
-rw-r--r-- | Juick/ViewControllers/NewPostViewController.m | 9 |
1 files changed, 4 insertions, 5 deletions
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 |