Input chiness


#1

I modify the ios code, now it can support chinese input(maybe other asia text input )

 

- (void) textViewDidChange : (UITextView*) textView

{

    if(textView.markedTextRange == nil) {

        owner->textViewReplaceCharacters (Range<int> (0, 1), nsStringToJuce (textView.text));

        textView.text = nullptr;

    }

}

 

- (BOOL) textView: (UITextView*) textView shouldChangeTextInRange: (NSRange) range replacementText: (NSString*) text

{

    (void) textView;

    if(text == nullptr || text.length == 0) {

        owner->textViewReplaceCharacters (Range<int> (0, 1), nsStringToJuce (text));

        textView.text = nullptr;

        return NO;

    }

    return YES;

}


#2

..thanks, but this code doesn't make much sense to me..

You've removed the code that actually uses the range, so only Range (0, 1) of the text will ever be replaced - i.e. the first character in the text (?)

And why do you call textViewReplaceCharacters (Range<int> (0, 1), nsStringToJuce (text)); when the text is always an empty string at that point? That's effectively just deleting the first character..