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
id<UITextInputTokenizer> tokenizer = textView.tokenizer; | |
UITextPosition *pos = textView.endOfDocument; | |
NSInteger lines = 0; | |
while (true){ | |
UITextPosition *lineEnd = [tokenizer positionFromPosition:pos toBoundary:UITextGranularityLine inDirection:UITextStorageDirectionBackward]; | |
if([textView comparePosition:pos toPosition:lineEnd] == NSOrderedSame){ | |
pos = [tokenizer positionFromPosition:lineEnd toBoundary:UITextGranularityCharacter inDirection:UITextStorageDirectionBackward]; | |