1

I use UITextInput in customView:

MyCode: https://github.com/lequysang/github_zip/blob/master/UITextInputDebug.zip

@property (strong,nonatomic) id<UITextInput> textInput;

After typing some chars, I want to go back 4 chars and replace text at this position (replace any to T).Current cursor at the end.

How to do that?

I try replaceRange with UITextRange but don't know how to get position and size with it!

Please help! Thanks in advance!

LE SANG
  • 10,955
  • 7
  • 59
  • 78

1 Answers1

0
replaceRange:withText:

Replace the text in a document that is in the specified range. (required)

- (void)replaceRange:(UITextRange *)range withText:(NSString *)text

Parameters

range

A range of text in a document.

text

A string to replace the text in range.

Availability Available in iOS 3.2 and later.

See Also

– textInRange: 

Declared In UITextInput.h

Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102
  • Thanks @Ramshad again!You give me a best way! But I'm stuck to get text position with UITextRange and UITextPosition. Please help you know! – LE SANG Mar 19 '13 at 00:49