Reputation: 1626
In C#/MonoTouch, I'd like to get the position of cursor in a UITextField as an integer offset from the start of the text contents. I'm stuck at what to do with a UITextPosition returned by tf.SelectedTextRange.start.
Upvotes: 1
Views: 236
Reputation: 89102
try this (t is your UITextField)
int index = t.GetOffsetFromPosition (t.BeginningOfDocument, t.SelectedTextRange.start);
Upvotes: 3