I’ve created a custom keyboard with my own Unicode characters… The app works great but when I press the back space it will sometimes not backspace and other times it will.. and often after I’ve gotten it to delete the previous character with my backspace the other letters buttons will no longer type the unicode characters I want…
Here is one of my Unicode characters code:
textViewString = [[NSString alloc] initWithFormat:@"%@%@", textView.text, char6String];
[textView setText:textViewString];
Where “char6string” would just be one of my unicode characters in this case “π”
Here is the backspace buttons code:
if ([textView.text length]>0) {
textView.text = [textView.text substringToIndex:([textView.text length]-1)];
}
Well, I figured out the problem and it’s a messy solution.. for whatever reason when you trio to add any of the new unicode characters that came out about 4 months ago to a text field via code it adds that unicode character along with a weird glitches unicode character that doesn’t exist resulting in uncopyable text and 2 characters added… so now I need to detect if when a button was pressed to add a character if it changes the length by 1 or 2 and if it changes the length by 2 it’s a new unicode character and I need to do an auto-delete then and there, otherwise if it only increases by one it’s fine and I don’t need to do anything!
My new add character to textView string looks like this for each button: