When I tap on a certain position in a UITextView, I want to retrieve the substring of the NSString which is shown at the line.
I have e.g. a UITextView which displays a string, using 16 lines. When I tap on position (200, 150), I want the substring which is shown by UITextView on that tap.
Any suggestions on how to achieve this?
If I understand your question correctly this is a possible solution. In your viewcontroller add an IBOutlet to a UITextView and make sure your viewcontroller implements the UITextViewDelegate. When connecting the UITextView to the FileOwner in InterfaceBuilder make sure you also point the delegate of the UITextView to the FileOwner.
Then in your UIViewController implementation file add this UITextViewDelegate Method.
Then each time you make a selection in the UITextView this method will get called. Use the selectedRange property of UITextView to get the NSRange the User made. From there you can just get the text from the UITextView and generate the correct substring.
I just added a UIAlertView in the textViewDidChangeSelection method to display the substring