ozmax
ozmax

Reputation: 470

Get keyboard input in cocoa

cocoa newbie here.
I try to take the input from keyboard and check it before it will be written on the nstextfield.
From searching i found keydown() and NSFirstResponder is what i need. But i cannot understand how to implement these things and generally how the thing with NSFirstResponder works.

Can someone help me with an example or some sources please?

Upvotes: 1

Views: 462

Answers (1)

Daij-Djan
Daij-Djan

Reputation: 50099

dont get the raw events in a textfield. instead implement this delegate in your controller:

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

return NO or YES to dis-/allow that change

Upvotes: 0

Related Questions