diff options
Diffstat (limited to 'Juick/ViewControllers/ChatViewController.m')
-rw-r--r-- | Juick/ViewControllers/ChatViewController.m | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m index 9493155..cfecc48 100644 --- a/Juick/ViewControllers/ChatViewController.m +++ b/Juick/ViewControllers/ChatViewController.m @@ -11,6 +11,8 @@ #import "MessageInputView.h" +#define kMessageInputInitialHeight 50 + @interface ChatViewController () @property (nonatomic, readwrite, retain) MessageInputView *accessoryView; @@ -37,6 +39,8 @@ [self addObserver:self forKeyPath:@"uname" options:0 context:nil]; #if TARGET_OS_MACCATALYST [self.stack addArrangedSubview:[self inputAccessoryView]]; +#else + self.stackBottomConstraint.constant = kMessageInputInitialHeight; #endif } @@ -102,11 +106,12 @@ if (userInfo) { CGRect beginFrame = [userInfo [UIKeyboardFrameBeginUserInfoKey] CGRectValue]; CGRect endFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; - CGFloat delta = endFrame.origin.y - beginFrame.origin.y; + CGFloat keyboardHeight = endFrame.origin.y - beginFrame.origin.y; CGFloat duration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue]; UIViewAnimationCurve animationCurve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]; + [UIView animateWithDuration:duration delay:0 options:(animationCurve << 16) animations:^{ - self.tableView.contentOffset = CGPointMake(0, self.tableView.contentOffset.y - delta); + self.tableView.contentOffset = CGPointMake(0, self.tableView.contentOffset.y - keyboardHeight); } completion:nil]; } } |