How to replace text in UITextView with selected range?

Since iOS 7 there is the textStorage in the textView that inherits from NSMutableAttributedString so you can use those methods:

Objective-C

[self.textView.textStorage replaceCharactersInRange:withString:];

or

[self.textView.textStorage replaceCharactersInRange:withAttributedString:];

Swift

textView.textStorage.replaceCharacters(in: range, with: string)

Well... I'm not sure to understand correctly what you're trying to do, but if your goal is to change some characters in a selected range you can follow these steps:

Get your UITextView content and put it in a NSString:

NSString *textViewContent = textView.text;

Change the characters in the range you want:

NSString *newContent = [textViewContent stringByReplacingCharactersInRange:range withString:replacement];

Replace old content with new one:

textView.text = newContent;

Anyway if you just want to replace Ask question here with Ask answer them the fastest solution is just:

textView.text = @"Ask answer them";