Set cursor position in a UITextField (Monotouch)

Posted by manuel on Stack Overflow See other posts from Stack Overflow or by manuel
Published on 2012-04-03T05:23:46Z Indexed on 2012/04/03 5:29 UTC
Read the original article Hit count: 1181

Filed under:
|
|
|

In a UITextView used for entering decimal numbers I would like to get rid of possible leading zeros (The behavior should be like the one of the Calculator App). Normally this would be rather easy to implement but I just cannot figure out how to restore the cursor position.

UITextField has a property SelectedTextRange of type UITextRange which can be used to get the cursor position. However, there seems no easy way to get the current index nor to create a new UITextRange object that contains the new values.

I could find the solution in objective c: Finding the cursor position in a UITextField It is however very unclear to me how to rewrite that in Monotouch. Any help with this would be highly appreciated.

Thanks, Manuel

© Stack Overflow or respective owner

Related posts about iphone

Related posts about monotouch