Forum Xamarin.iOS

UITextView cursor position


I was just wondering if anyone has a way to find the coordinates of the text cursor in relation to the uitextview it is in?



  • LandLuLandLu Member, Xamarin Team Xamurai

    Get the beginning of the text view's text:
    var startPosition = MyTextView.BeginningOfDocument;
    The current text view's selected range:
    var selectedRange = MyTextView.SelectedTextRange;
    At last you can get the cursor's position:
    var cursorPosition = MyTextView.GetOffsetFromPosition(startPosition, selectedRange.Start);

Sign In or Register to comment.