Brion VIBBER has submitted this change and it was merged. Change subject: When keyboard appears on edit, scroll cursor above keyboard. ......................................................................
When keyboard appears on edit, scroll cursor above keyboard. Change-Id: I0ee7969922cec156c67a1ca65cb67e0397006fac --- M wikipedia/View Controllers/SectionEditor/SectionEditorViewController.m 1 file changed, 13 insertions(+), 0 deletions(-) Approvals: Brion VIBBER: Verified; Looks good to me, approved diff --git a/wikipedia/View Controllers/SectionEditor/SectionEditorViewController.m b/wikipedia/View Controllers/SectionEditor/SectionEditorViewController.m index a7b5c84..ac59abd 100644 --- a/wikipedia/View Controllers/SectionEditor/SectionEditorViewController.m +++ b/wikipedia/View Controllers/SectionEditor/SectionEditorViewController.m @@ -295,6 +295,14 @@ UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, viewKeyboardRect.size.height, 0.0); self.editTextView.contentInset = contentInsets; self.editTextView.scrollIndicatorInsets = contentInsets; + + // Mark the text view as needing a layout update so the inset changes above will + // be taken in to account when the cursor is scrolled onscreen. + [self.editTextView setNeedsLayout]; + [self.editTextView layoutIfNeeded]; + + // Scroll cursor onscreen if needed. + [self scrollTextViewSoCursorNotUnderKeyboard:self.editTextView]; } - (void)keyboardWillBeHidden:(NSNotification*)aNotification @@ -313,6 +321,11 @@ CGRect cursorRectInTextView = [textView caretRectForPosition:textView.selectedTextRange.start]; CGRect cursorRectInView = [textView convertRect:cursorRectInTextView toView:self.view]; if(CGRectIntersectsRect(self.viewKeyboardRect, cursorRectInView)){ + + CGFloat margin = -20; + // Margin here is the amount the cursor will be scrolled above the top of the keyboard. + cursorRectInTextView = CGRectInset(cursorRectInTextView, 0, margin); + [textView scrollRectToVisible:cursorRectInTextView animated:YES]; } } -- To view, visit https://gerrit.wikimedia.org/r/130219 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0ee7969922cec156c67a1ca65cb67e0397006fac Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Mhurd <mh...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits