Skip to content

Instantly share code, notes, and snippets.

@kylehowells
Created November 10, 2014 22:16
Show Gist options
  • Save kylehowells/c27f2f1b4dd8bd8d3661 to your computer and use it in GitHub Desktop.
Save kylehowells/c27f2f1b4dd8bd8d3661 to your computer and use it in GitHub Desktop.
// Variables
kb = [UIKeyboardImpl sharedInstance]; l = [kb _layout]; inputDelegate = [kb inputDelegate];
// Some subclass of UITextRange (WKTextRange)
textRange = [inputDelegate selectedTextRange];
// Some subclass of UITextPosition (WKTextPosition)
//start = [textRange start];
//end = [textRange end];
begin = [inputDelegate beginningOfDocument];
end = [inputDelegate endOfDocument];
// Some subclass of UITextRange (WKTextRange)
fullRange = [inputDelegate textRangeFromPosition:begin toPosition:end];
[inputDelegate setSelectedTextRange:fullRange];
// THIS CODE ABOVE SHOULD SELECT ALL TEXT
// 2 = UITextLayoutDirectionRight
start = [inputDelegate positionFromPosition:begin inDirection:2 offset:2];
end = [inputDelegate positionFromPosition:end inDirection:3 offset:2];
fullRange = [inputDelegate textRangeFromPosition:begin toPosition:end];
[inputDelegate setSelectedTextRange:fullRange];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment