Skip to content

Commit

Permalink
Give a little bit love to iPhone X
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Nov 4, 2017
1 parent 3d78d39 commit 28288b7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Blink/SpaceController.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ - (void)loadView
_viewportsController.delegate = self;

[self addChildViewController:_viewportsController];

[self.view addSubview:_viewportsController.view];
[_viewportsController didMoveToParentViewController:self];
[_viewportsController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
Expand Down Expand Up @@ -212,7 +213,7 @@ - (void)keyboardWasShown:(NSNotification *)sender
{
CGRect frame = [sender.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect newFrame = [self.view convertRect:frame fromView:[[UIApplication sharedApplication] delegate].window];
_bottomConstraint.constant = newFrame.origin.y - CGRectGetHeight(self.view.frame);
_bottomConstraint.constant = newFrame.origin.y - CGRectGetHeight(self.view.frame) + self.bottomLayoutGuide.length;

UIView *termAccessory = [self.currentTerm.terminal inputAccessoryView];
if ([termAccessory isHidden]) {
Expand All @@ -221,13 +222,22 @@ - (void)keyboardWasShown:(NSNotification *)sender

[self.view setNeedsUpdateConstraints];
}

- (void)keyboardWillBeHidden:(NSNotification *)aNotification
{
_bottomConstraint.constant = 0;
[self.view updateConstraintsIfNeeded];
[self.view setNeedsUpdateConstraints];
}

// Support iPhone X
- (void)viewLayoutMarginsDidChange {
_topConstraint.constant = self.topLayoutGuide.length;
[super viewLayoutMarginsDidChange];
[self.view updateConstraintsIfNeeded];
[self.view setNeedsUpdateConstraints];
}

- (void)handleTwoFingersTap:(UITapGestureRecognizer *)sender
{
[self _createShellWithUserActivity: nil animated:YES completion:nil];
Expand Down

0 comments on commit 28288b7

Please sign in to comment.