I want the selected text to be programmatic, and since iOS5 UITextView and UITextField match UITextInput, this should be possible, but for some reason I always get markedText as zero. :( What am I missing here?
Here is what I tried without success:
(While textview is the first Responder)
1.- If the text view does not contain text:
text: "", selectedRange: {0,0}, markedText: no.
[_textView setMarkedText:@"ζ" selectedRange:NSMakeRange(0, 1)];
Result: text: "", selectedRange: {0,0}, markedText: nil. (Nothing changed)
2.- When the text view contains text + marked text:
text: "AAA", selectedRange = {0,3}, marked text at the end: "ε€ͺι½" then I do:
[_textView setMarkedText:@"ε°" selectedRange:NSMakeRange(0,3)];
Result: text: "AAA", selectedRange: {0,3}, markedText: nil; (marked text has become null)
In both cases, it is like setMarkedText:selectedRange: will set the currently marked text (if any) to nil.
Any help would be greatly appreciated :)
UPDATE
Since the concept of tagged text seems unclear, here is an explanation:
In multi-stage input languages ββ(e.g., Japanese), you can enter plain text (e.g., English) or enter marked text (e.g., Japanese).
Here I wrote plain text: regular text , then I wrote selected text γ€ and then I wrote selected text γ , so it was added to γ€γ .
Marked text (text in a blue box) represents a transitional or intermediate input stage, as it can turn into other characters / words called candidates. Candidates are shown in a large box.
This screenshot was taken using the bluetooth keyboard on the iPad, but you will get similar results when using the soft keyboard when writing Japanese.
Before recording γ€ text representation was:
textView.text : "regular text" textView.selectedRange : {12,0} textView.markedText:nil
Then I wrote γ€ and the text view became:
textView.text : "regular textγ€" textView.selectedRange : {13,0} textView.markedText: "γ€"
Then I wrote γ and the text view became as follows:
textView.text : "regular textγ€γ" textView.selectedRange : {14,0} textView.markedText: "γ€γ"
What is the current state of the text view.
I want to be able to mark text programmatically :)
Is it possible? - According to UITextInput docs this.
