Last active
December 27, 2015 16:29
-
-
Save dasdom/7355562 to your computer and use it in GitHub Desktop.
Code to move the cursor in a UITextView with a pan.
This file contains hidden or 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
- (void)panHappend:(UIPanGestureRecognizer*)sender | |
{ | |
if (sender.state == UIGestureRecognizerStateBegan) | |
{ | |
self.startRange = self.postTextView.selectedRange; | |
} | |
NSRange selectedRange = {MAX(self.startRange.location+(NSInteger)([sender translationInView:self.view].x/8.0f), 0), 0}; | |
self.postTextView.selectedRange = selectedRange; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment