private void MoveCursorToRight() { _virtualCursorPosition += 10; var cursorPosition = _content.GetPosition(_content.BeginningOfDocument, _virtualCursorPosition); var cursorFrame = _content.GetCaretRectForPosition(cursorPosition); _cursor.ChangePosition(cursorFrame.X, cursorFrame.Y); }
void AppendText(string text) { Console.Write(text); _textOutput.InvokeOnMainThread(() => { _textOutput.Text = _textOutput.Text + text; var bounds = _textOutput.GetCaretRectForPosition(_textOutput.SelectedTextRange.Start); _textOutput.ScrollRectToVisible(bounds, false); }); }
private static void AdjustTextViewSelection(UITextView textView) { // Ensure that the text view is visible by making the text view frame smaller as text can be slightly cropped at the bottom. // Note that this is a workwaround to a bug in iOS. textView.LayoutIfNeeded(); var caretRect = textView.GetCaretRectForPosition(textView.SelectedTextRange.End); caretRect.Height += textView.TextContainerInset.Bottom; textView.ScrollRectToVisible(caretRect, false); }
private void scrollToCursorForTextView(UITextView textView) { CoreGraphics.CGRect cursorRect = textView.GetCaretRectForPosition(textView.SelectedTextRange.Start); cursorRect = this._tableView.ConvertRectFromView(cursorRect, textView); if (this.rectVisible(cursorRect)) { CoreGraphics.CGSize tempSize = cursorRect.Size; tempSize.Height += 8; cursorRect.Size = tempSize; this._tableView.ScrollRectToVisible(cursorRect, true); } }
private void AdjustTextViewSelection(UITextView textView) { // Ensure that the text view is visible by making the text view frame smaller as text can be slightly cropped at the bottom. // Note that this is a workwaround to a bug in iOS. textView.LayoutIfNeeded (); var caretRect = textView.GetCaretRectForPosition (textView.SelectedTextRange.End); caretRect.Height += textView.TextContainerInset.Bottom; textView.ScrollRectToVisible (caretRect, animated: false); }
private void scrollToCursorForTextView(UITextView textView) { CoreGraphics.CGRect cursorRect = textView.GetCaretRectForPosition (textView.SelectedTextRange.Start); cursorRect = this._tableView.ConvertRectFromView (cursorRect, textView); if(this.rectVisible(cursorRect)) { CoreGraphics.CGSize tempSize = cursorRect.Size; tempSize.Height += 8; cursorRect.Size = tempSize; this._tableView.ScrollRectToVisible (cursorRect, true); } }