iphone - Can I select a specific block of text in a UITextField? -


I have UIT field in my iPhone app. I know how to select all the text in the text field, but the selection How can I change? Say I wanted to choose the last 5 letters, or a specific category of characters, is it possible? If not, can I move the beginning and end of the selection, as if the user is dragging them?

With UITextField, you can not do so, but if you are looking at the header, You can add some categories that you can use;)


Update for IOS5 and above:

Now UITextField and UITextView are compatible with the UITextInput protocol, so this is possible :)

The previous 5 characters must be selected before the carrot:

  // Get the current selected category , Consider this example Land that is an insertion point or empty selection UITextRange * selectedRange = [textField selected Patlek]; // Calculate the new position, - left and right uitadepation * nepozy = [textfield position appromotion: selected range offset offset: -5]; // Create a new range using the UITCaptacNext object, our textfield UITclerrex * NewRang = [TextFilter Text Range Frame: Position: Npozion to Poison: Select Range. Start]; // Set new category [Textfield SetSecited Text Range: NewRenz];  

Comments