Is it possible to detect at what text position the user tabs into a UITextField (just tabbing not editing, the text field is read-only)? E.g. by capturing the touches began event and then processing the tabbed position?
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.
Yes, set a delegate for UITextField and you can tell what the user is doing in the text field. See the UITextField class reference for details.
EDIT: OK, since it’s a readonly text field, you should subclass UITextField and override the beginTrackingWithTouch:withEvent: and endTrackingWithTouch:withEvent: so you can see where the touch down and touch up occurred withing the UIControl (UITextField is a UIControl). Those methods are called with a UITouch object that tells you where the touch occurred within the UIControl (UITextField).
I don’t know why you would want to do this. But anyway from there you’ll have to figure out where in the text the touch occurred given the touch x,y offset in the control. That’ll be another fun task to solve.