Is there a way to prevent the user from moving the cursor in a UITextField? I’d like it to stay at the end of the string.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no way to prevent them from moving the cursor. You can, however, prevent them from editing the text except at the end by implementing the
– textField:shouldChangeCharactersInRange:replacementString:method in your text field’s delegate.
Edit: you can also set
userInteractionEnabledtoNOso that the user can’t tap the field. CallbecomeFirstRespondermanually so that the field gets focus since the user can’t tap to focus.