Skip to content

Instantly share code, notes, and snippets.

@AKiniyalocts
Created September 26, 2016 14:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AKiniyalocts/c0e949e5bcc0c6832e522e95933c792b to your computer and use it in GitHub Desktop.
Save AKiniyalocts/c0e949e5bcc0c6832e522e95933c792b to your computer and use it in GitHub Desktop.
Scrolling a tableview along with a cursor inside of a UITextView
-(void)textViewDidChangeSelection:(UITextView *)textView {
CGPoint cursorPosition = [textView caretRectForPosition:textView.selectedTextRange.start].origin;
[self.tableView scrollRectToVisible:CGRectMake(cursorPosition.x, cursorPosition.y
, textView.frame.size.width, textView.frame.size.height) animated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment