summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-22 02:59:21 +0300
committerGravatar Vitaly Takmazov2017-12-22 02:59:21 +0300
commitaa68712497002d46ef5a604bd5e84b268f927049 (patch)
tree9b428bbf18624c45fc8d9fbf234d325b4fff5848 /Juick/ViewControllers
parentba0f1acba2f9a582051d58c00c04e3606cf7347a (diff)
Fix keyboard height constraint
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r--Juick/ViewControllers/NewPostViewController.m9
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