Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. @property int isTyping;
  2.  
  3. - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
  4.  
  5. [self startTyping];
  6.  
  7. [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(stopTyping) object:nil];
  8. [self performSelector:@selector(stopTyping) withObject:nil afterDelay:0.5];
  9.  
  10. return YES;
  11. }
  12.  
  13. - (void)startTyping {
  14.  
  15. if (self.isTyping==0) {
  16. self.isTyping=1;
  17. [self sendTypingStartData];
  18. }
  19. }
  20.  
  21. - (void)stopTyping {
  22. self.isTyping=0;
  23. [self sendTypingStopData];
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement