daspianist
daspianist

Reputation: 5525

Best practices for detecting when "user is typing" for chat functionalities?

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!

Upvotes: 0

Views: 491

Answers (1)

Saheb Roy
Saheb Roy

Reputation: 5967

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

Upvotes: 3

Related Questions