Setting cursor position of UITextField


I´ve looked at the monotouch samples and tried:

var range = new NSRange(selectionStart, 1); NumberTextField.SelectedTextRange = IndexedRange.GetRange(range);

But this causes this exception at runtime: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[iOS_IndexedRange asRange]: unrecognized selector sent to instance 0x7d9bd690

I also looked at a lot of objective-c versions but i cant figure out how to do them on monotouch.


Ruben Macias over at the Xamarin forums helped me.

entryField.BecomeFirstResponder(); var indexToSet = 3; //set cursor after the 3rd letter var positionToSet = entryField.GetPosition(entryField.BeginningOfDocument, indexToSet); entryField.SelectedTextRange = entryField.GetTextRange(positionToSet, positionToSet);


  • Can a local notification only vibrate the apple watch and not play a sound?
  • Linq, VB - Anonymous type cannot be converted to anonymous type
  • HTTPS page was not allowed to run insecure content from safari-extension:// URI
  • Attunity connectors are not showing in SSIS for VS 2017, SQL Server 2017
  • Microsoft Visual Basic: how to initialize an array variable?
  • WPF Keyboard Modifier on MouseBinding
  • Should I declare system call functions in C?
  • Forward declarations cause errors after code refactor
  • R- knitr:kable - How to display table without column names?
  • ontimeupdate with YouTube API
  • Access to printer settings (DEVMODE) on windows 7
  • how to calculate the values in table view and to display in separate label
  • Heroku server error (500) when Debug = False , whitenoise could not find style.css
  • ActiveMQ AMQP with JMS transformer leveraging spring Integration
  • Jupyter: Seaborn pairplot difficult to set graph dimensions for?
  • Operators and quote precedence in obfuscated cmd
  • Windows Phone 7: All I get is System.MethodAccessException
  • Passing Objects to fragment without argument
  • Is there a better approach to use BeautifulSoup in my python web crawler codes?
  • set clipboard content in any browser
  • jquery: Disable/Enable button not working after reset
  • Is it possible to use LinkShare signatures in an iOS Smart Banner?
  • Python: Why am I getting a UnicodeDecodeError?
  • NextJS auth with an external server
  • android 3G signal strength
  • how to synchronize web site content while loading page
  • Firestore: Version history of documents
  • How to display converted time zones in a 'generic week' (Sunday thru Saturday)?
  • Keep rows with certain values always at the bottom while sorting in jquery tablesorter plugin
  • trigger ontouch event programmatically
  • Comparing variables with strings bash
  • How to get rgb from transparent pixel in js
  • Write to .csv file with PHP (Commas in Data Error)