UITextField caret position is incorrect after setting text
| Originator: | brian | ||
| Number: | rdar://16768442 | Date Originated: | 4/30/2014 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.1.1 |
| Classification: | Reproducible: | Always |
Summary: Using a UITextField that has been configured with a clearButtonMode of either UITextFieldViewModeAlways or UITextFieldViewModeWhileEditing will have an incorrect caret position when programmatically becoming the first responder. UITextFields configured with different clearButtonModes do not exhibit this behavior. Steps to Reproduce: 1. Create a project that has a UITextField 2. Configure the UITextField's clearButtonMode to either UITextFieldViewModeAlways or UITextFieldViewModeWhileEditing 3. Programmatically instruct that UITextField to become the first responder 4. Set the text of the UITextField to a string which has a length greater than the width of the UITextField Expected Results: The currently editing UITextField's caret should be at the end of the text that has previously been set. Actual Results: The caret's position seems to be off by about twice the width of the clear button views frame which means a user has to tap and hold, then scrub to the actual end of the text so they may continue to edit it. Version: iOS 7.1.1 Notes: A link to a video of the attached sample code, http://cl.ly/0w2g21293D3B
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!