0

I am currently using PubNub to handle the realtime aspects of chat, and plan to change a PNChannel's state when a user is typing or has completed typing.

My question relates more to the client side of how something like an isTyping state can be measured . Since every tap on the screen keyboard is bound to have some space of time in between, I was wondering if there is a "best practice" way to either measure the time gaps between screen taps to understand whether a user is typing (for example, a slow typer versus a faster typer) versus when the user has actually stopped typing?

Thanks!

daspianist
  • 5,336
  • 8
  • 50
  • 94
  • Use `NSTimer` in combination with detecting keystrokes. It's up to you to decide how much time can go by after the last detected keystroke and still consider it "typing". – rmaddy Jul 25 '14 at 05:09

1 Answers1

3

You can look up in these delegate methods of UITextField

-(void)textFieldDidBeginEditing:(UITextField *)sender //method fires when u start begining typing anything in a textfield
-(BOOL) textFieldShouldReturn:(UITextField *) textField // method fires whenever u type anything in a textfield- returns character wise
-(void)textFieldDidEndEditing:(UITextField *)sender // fires when u finished typing stuffs in a textfield.

Hope this helps

Kumar KL
  • 15,315
  • 9
  • 38
  • 60
Saheb Roy
  • 5,899
  • 3
  • 23
  • 35