ios - Extra call to setMarkedText:selectedRange in iOS7? -


I have implemented UITextInput in my app, so I use multi-stage key input (Japanese, Chinese keyboard ) For my custom text view, I see in iOS7, when you have some text that is marked, and you tap one of the tips above the keyboard to change it, that it is SetMarkedText: selectedRange is called twice: once the place changes, the pan at the top of the keyboard Text marked with the selected string from L (as you were expecting), and once the empty string is sent as a parameter in IOS6, it is called only once.

My questions are, is there any reason to do this? And how should I adjust my setMarkedText: selectedRange to this account (listed below):

  - (zero) setMarkedText: (NSString *) marked text Selected range: (NSRange) SelectedRange {NSRC selectedNesense = self.textView.selectedTextRange; TeXchange = self.textView.markedTextRange marked as NSRange; If (markedtextranz.place! = NSNotFound) {if marked (marked!) Text = @ ""; [Self. Replace the text of the label: String with marked tagchange: text marked]; MarkTextRange.length = markedText.length; } And if (selectedNSRange.length> gt; {} changes {self.text; Curriculum series: string with selected senses: marked text]; MarkTextRange.location = selectedNSRange.location; MarkTextRange.length = markedText.length; } And {{self.text insertString: markedText atIndex: selectedNSRange.location]; MarkTextRange.location = selectedNSRange.location; MarkTextRange.length = markedText.length; } SelectNSRange = NSMakeRange (selectedRange.location + marked text archive location, selectedRange.length); Self.textView.contentText = self.text; Self.textView.markedTextRange = Mark; Self.textView.selectedTextRange = selectedNSRange;   

My first trend is that

  if the marked text! = @ ""   

But I'm not sure I'm messing up in some other cases. Is there any suggestion about the account for this change ??

DTS-boy recommends this solution:

  - (Zero) setMarkedText: (NSString *) marked text selected range: (NSRange) selected range {... if (markedText == zero} marked text.long == 0} {[self unmarkText]; }}   

And it seems to work fine.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -