How to set Cursor in TextField?

Set cursor at end of textfield in Xcode

  • I have a textfield that may not be able to display its entire contents. When this happens, I'd like to display the right-most contents instead of the left-most contents. Effectively this means I want to set the cursor in the textfield at the right-most position so the contents automatically move in. How can I do this? Thanks!

  • Answer:

    NSRange range = NSMakeRange([[textView string] length], 0); [textView setSelectedRange: range]; I'm assuming on OS X because of the tag. Look to http://borkware.com/quickies/one?topic=NSTextView.

simon.d at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.