shouldChangeCharactersInRange reports incorrect range with Pinyin keyboard on iOS7
| Originator: | russell.sayers | ||
| Number: | rdar://15584633 | Date Originated: | Dec-4-2012 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | |
| Classification: | Other Bug | Reproducible: | Always |
On ios6 UITextFieldDelegate protocol method shouldChangeCharactersInRange reports a range length of 1 when you backspace text on the Pinyin keyboard. On ios7 range length is the length of the "selected" markedTextRange multistage text input.
Steps to Reproduce:
1. Create a simple project in XCode5 with a single textbox
2. Add UITextFieldDelegate shouldChangeCharactersInRange
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSLog(@" location:%lu length:%lu ", (unsigned long)range.location, (unsigned long)range.length);
return true;
}
3. Launch app on ios6 simulator. Set your keyboard to "Chinese Simplified Pinyin.
4. On ios6 type "banana", press backspace 6 times to remove the text. Logged results:
string b location:0 length:0
string a location:1 length:0
string n location:2 length:0
string a location:3 length:0
string n location:4 length:0
string a location:5 length:0
string location:5 length:1
string location:4 length:1
string location:3 length:1
string location:2 length:1
string location:1 length:1
string location:0 length:1
6. Repeat above step on ios7. Ensure keyboard is "Chinese Simplified Pinyin.
string b location:0 length:0
string a location:1 length:0
string n location:2 length:0
string a location:3 length:0
string n location:5 length:0
string a location:6 length:0
string location:0 length:6
string location:0 length:6
string location:0 length:5
string location:0 length:3
string location:0 length:2
string location:0 length:1
4. Note the difference in length values in ios7
Expected Results:
Consistent values for range length between ios6 and ios7
Actual Results:
ios7 appears to be reporting the markedTextRange multistage text input.
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!