Skip to content

Commit 10965c8

Browse files
author
dzenbot
committed
Fixes an issue on 3.5" causing the auto-correction view to not layout properly
1 parent d9aa135 commit 10965c8

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

Examples/Messenger/Messenger-Shared/MessageViewController.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ - (BOOL)canPressRightButton
269269

270270
- (BOOL)canShowAutoCompletion
271271
{
272-
NSLog(@"%s",__FUNCTION__);
273-
274272
NSArray *array = nil;
275273
NSString *prefix = self.foundPrefix;
276274
NSString *word = self.foundWord;

Source/Classes/SLKTextViewController.m

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -809,13 +809,7 @@ - (void)didTapScrollView:(UIGestureRecognizer *)gesture
809809

810810
- (void)didPanTextView:(id)sender
811811
{
812-
// Skips if the text view is already first responder
813-
if ([self.textView isFirstResponder]) {
814-
return;
815-
}
816-
817-
// Become first responder and enable keyboard
818-
[self.textView becomeFirstResponder];
812+
[self presentKeyboard:YES];
819813
}
820814

821815
- (void)editText:(NSString *)text
@@ -1432,16 +1426,21 @@ - (void)showAutoCompletionView:(BOOL)show
14321426
viewHeight = [self maximumHeightForAutoCompletionView];
14331427
}
14341428

1435-
CGFloat tableHeight = self.scrollViewHC.constant;
1429+
CGFloat tableHeight = self.scrollViewHC.constant + self.autoCompletionViewHC.constant;
14361430

1437-
// If the the view controller extends it layout beneath it navigation bar and/or status bar, we then reduce it from the table view height
1438-
if (self.edgesForExtendedLayout == UIRectEdgeAll || self.edgesForExtendedLayout == UIRectEdgeTop) {
1439-
tableHeight -= CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
1440-
tableHeight -= self.navigationController.navigationBar.frame.size.height;
1431+
// Only when the view extends its layout beyond it top edge
1432+
if ((self.edgesForExtendedLayout & UIRectEdgeTop) > 0) {
1433+
1434+
// On iOS7, the status bar isn't automatically hidden on landscape orientation
1435+
if (UI_IS_IPHONE && UI_IS_LANDSCAPE && !UI_IS_IOS8_AND_HIGHER) {
1436+
tableHeight -= CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
1437+
}
1438+
1439+
tableHeight -= CGRectGetHeight(self.navigationController.navigationBar.frame);
14411440
}
14421441

14431442
// On iPhone, the autocompletion view can't extend beyond the table view height
1444-
if (viewHeight > tableHeight) {
1443+
if (UI_IS_IPHONE && viewHeight > tableHeight) {
14451444
viewHeight = tableHeight;
14461445
}
14471446

@@ -1691,7 +1690,7 @@ - (void)setupViewConstraints
16911690
@"textInputbar": self.textInputbar,
16921691
};
16931692

1694-
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView(0@750)][autoCompletionView(0)][typingIndicatorView(0)]-0@999-[textInputbar(>=0)]|" options:0 metrics:nil views:views]];
1693+
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView(0@750)][autoCompletionView(0@750)][typingIndicatorView(0)]-0@999-[textInputbar(>=0)]|" options:0 metrics:nil views:views]];
16951694
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" options:0 metrics:nil views:views]];
16961695
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[autoCompletionView]|" options:0 metrics:nil views:views]];
16971696
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[typingIndicatorView]|" options:0 metrics:nil views:views]];

0 commit comments

Comments
 (0)