t9mike
t9mike

Reputation: 1626

Geting the current position in a UITextField

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

Answers (1)

Jason
Jason

Reputation: 89102

try this (t is your UITextField)

int index = t.GetOffsetFromPosition (t.BeginningOfDocument, t.SelectedTextRange.start);

Upvotes: 3

Related Questions