Created
October 15, 2012 22:08
-
-
Save kickingvegas/3895895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITextRange *)rangeForWordAtPoint:(CGPoint p) { | |
UITextPosition *position = [_textView closestPositionToPoint:p]; | |
UITextRange *range = | |
[_textView rangeEnclosingPosition:position | |
withGranularity:UITextGranularityWord | |
inDirection:UITextLayoutDirectionForward]; | |
// UITextStorageDirectionForward, not UITextStorageDirectionRight! | |
return range; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment